deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marios@redhat.com" <mandr...@redhat.com>
Subject Re: [PATCH core] CIMI: Added Collection models
Date Fri, 02 Dec 2011 13:07:39 GMT
ACK, only thing missing is to add operations to each collection -
especially the 'add' link which tells clients where to POST to create a
new Thing when looking at ThingCollection

On 02/12/11 12:41, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mfojtik@redhat.com>
> 
> Signed-off-by: Michal fojtik <mfojtik@redhat.com>
> ---
>  server/lib/cimi/model.rb                           |    9 +++++
>  server/lib/cimi/model/base.rb                      |    9 ++++-
>  server/lib/cimi/model/machine.rb                   |    2 -
>  server/lib/cimi/model/machine_admin.rb             |    6 ++-
>  server/lib/cimi/model/machine_admin_collection.rb  |   34 ++++++++++++++++++
>  server/lib/cimi/model/machine_collection.rb        |   34 ++++++++++++++++++
>  server/lib/cimi/model/machine_configuration.rb     |    2 -
>  .../cimi/model/machine_configuration_collection.rb |   34 ++++++++++++++++++
>  server/lib/cimi/model/machine_image.rb             |    2 -
>  server/lib/cimi/model/machine_image_collection.rb  |   34 ++++++++++++++++++
>  server/lib/cimi/model/machine_template.rb          |    2 -
>  .../lib/cimi/model/machine_template_collection.rb  |   34 ++++++++++++++++++
>  server/lib/cimi/model/volume.rb                    |    2 -
>  server/lib/cimi/model/volume_collection.rb         |   34 ++++++++++++++++++
>  server/lib/cimi/model/volume_configuration.rb      |    4 +--
>  .../cimi/model/volume_configuration_collection.rb  |   34 ++++++++++++++++++
>  server/lib/cimi/model/volume_image.rb              |    2 -
>  server/lib/cimi/model/volume_image_collection.rb   |   34 ++++++++++++++++++
>  server/lib/cimi/model/volume_template.rb           |    2 -
>  .../lib/cimi/model/volume_template_collection.rb   |   34 ++++++++++++++++++
>  server/lib/cimi/server.rb                          |   36 ++++++++++----------
>  21 files changed, 345 insertions(+), 39 deletions(-)
>  create mode 100644 server/lib/cimi/model/machine_admin_collection.rb
>  create mode 100644 server/lib/cimi/model/machine_collection.rb
>  create mode 100644 server/lib/cimi/model/machine_configuration_collection.rb
>  create mode 100644 server/lib/cimi/model/machine_image_collection.rb
>  create mode 100644 server/lib/cimi/model/machine_template_collection.rb
>  create mode 100644 server/lib/cimi/model/volume_collection.rb
>  create mode 100644 server/lib/cimi/model/volume_configuration_collection.rb
>  create mode 100644 server/lib/cimi/model/volume_image_collection.rb
>  create mode 100644 server/lib/cimi/model/volume_template_collection.rb
> 
> diff --git a/server/lib/cimi/model.rb b/server/lib/cimi/model.rb
> index 243f693..d11d77b 100644
> --- a/server/lib/cimi/model.rb
> +++ b/server/lib/cimi/model.rb
> @@ -33,3 +33,12 @@ require 'cimi/model/machine_admin'
>  require 'cimi/model/volume_configuration'
>  require 'cimi/model/volume_image'
>  require 'cimi/model/volume_template'
> +require 'cimi/model/machine_template_collection'
> +require 'cimi/model/machine_image_collection'
> +require 'cimi/model/machine_configuration_collection'
> +require 'cimi/model/machine_collection'
> +require 'cimi/model/volume_collection'
> +require 'cimi/model/machine_admin_collection'
> +require 'cimi/model/volume_configuration_collection'
> +require 'cimi/model/volume_image_collection'
> +require 'cimi/model/volume_template_collection'
> diff --git a/server/lib/cimi/model/base.rb b/server/lib/cimi/model/base.rb
> index ddc1b8a..f8ee983 100644
> --- a/server/lib/cimi/model/base.rb
> +++ b/server/lib/cimi/model/base.rb
> @@ -204,8 +204,13 @@ class CIMI::Model::Base
>      scalar :name
>    end
>  
> -  def self.act_as_root_entity
> -    CIMI::Model.register_as_root_entity! xml_tag_name.pluralize.uncapitalize
> +  def self.act_as_root_entity(name=nil)
> +    if name
> +      name = name.to_s.camelize.pluralize
> +    else
> +      name = xml_tag_name.pluralize.uncapitalize
> +    end
> +    CIMI::Model.register_as_root_entity! name
>    end
>  
>    def self.all(_self); find(:all, _self); end
> diff --git a/server/lib/cimi/model/machine.rb b/server/lib/cimi/model/machine.rb
> index e77e3b7..cff2dd5 100644
> --- a/server/lib/cimi/model/machine.rb
> +++ b/server/lib/cimi/model/machine.rb
> @@ -17,8 +17,6 @@ require 'deltacloud/models/instance_address'
>  
>  class CIMI::Model::Machine < CIMI::Model::Base
>  
> -  act_as_root_entity
> -
>    text :state
>    text :cpu
>  
> diff --git a/server/lib/cimi/model/machine_admin.rb b/server/lib/cimi/model/machine_admin.rb
> index 4f73223..dff5065 100644
> --- a/server/lib/cimi/model/machine_admin.rb
> +++ b/server/lib/cimi/model/machine_admin.rb
> @@ -15,8 +15,6 @@
>  
>  class CIMI::Model::MachineAdmin < CIMI::Model::Base
>  
> -  act_as_root_entity
> -
>    text :username
>    text :password
>    text :key
> @@ -25,4 +23,8 @@ class CIMI::Model::MachineAdmin < CIMI::Model::Base
>      scalar :rel, :href
>    end
>  
> +  def self.find(id, context)
> +    [] # TODO: Implement this
> +  end
> +
>  end
> diff --git a/server/lib/cimi/model/machine_admin_collection.rb b/server/lib/cimi/model/machine_admin_collection.rb
> new file mode 100644
> index 0000000..2705d82
> --- /dev/null
> +++ b/server/lib/cimi/model/machine_admin_collection.rb
> @@ -0,0 +1,34 @@
> +# Licensed to the Apache Software Foundation (ASF) under one or more
> +# contributor license agreements.  See the NOTICE file distributed with
> +# this work for additional information regarding copyright ownership.  The
> +# ASF licenses this file to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance with the
> +# License.  You may obtain a copy of the License at
> +#
> +#       http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing, software
> +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> +# License for the specific language governing permissions and limitations
> +# under the License.
> +
> +class CIMI::Model::MachineAdminCollection < CIMI::Model::Base
> +
> +  act_as_root_entity :machine_admin
> +
> +  array :machine_admin do
> +    scalar :href
> +  end
> +
> +  def self.default(context)
> +    self.new(
> +      :uri => context.machine_admins_url,
> +      :name => 'default',
> +      :created => Time.now,
> +      :description => "#{context.driver.name.capitalize} MachineAdminCollection",
> +      :machine_admin => MachineAdmin.all(context).map { |c| { :href => c.uri }
}
> +    )
> +  end
> +
> +end
> diff --git a/server/lib/cimi/model/machine_collection.rb b/server/lib/cimi/model/machine_collection.rb
> new file mode 100644
> index 0000000..d976e9a
> --- /dev/null
> +++ b/server/lib/cimi/model/machine_collection.rb
> @@ -0,0 +1,34 @@
> +# Licensed to the Apache Software Foundation (ASF) under one or more
> +# contributor license agreements.  See the NOTICE file distributed with
> +# this work for additional information regarding copyright ownership.  The
> +# ASF licenses this file to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance with the
> +# License.  You may obtain a copy of the License at
> +#
> +#       http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing, software
> +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> +# License for the specific language governing permissions and limitations
> +# under the License.
> +
> +class CIMI::Model::MachineCollection < CIMI::Model::Base
> +
> +  act_as_root_entity :machine
> +
> +  array :machine do
> +    scalar :href
> +  end
> +
> +  def self.default(context)
> +    self.new(
> +      :uri => context.machines_url,
> +      :name => 'default',
> +      :created => Time.now,
> +      :description => "#{context.driver.name.capitalize} MachineCollection",
> +      :machine => Machine.all(context).map { |c| { :href => c.uri } }
> +    )
> +  end
> +
> +end
> diff --git a/server/lib/cimi/model/machine_configuration.rb b/server/lib/cimi/model/machine_configuration.rb
> index 6bf76b8..d36ebdf 100644
> --- a/server/lib/cimi/model/machine_configuration.rb
> +++ b/server/lib/cimi/model/machine_configuration.rb
> @@ -15,8 +15,6 @@
>  
>  class CIMI::Model::MachineConfiguration < CIMI::Model::Base
>  
> -  act_as_root_entity
> -
>    struct :memory do
>      scalar :quantity
>      scalar :units
> diff --git a/server/lib/cimi/model/machine_configuration_collection.rb b/server/lib/cimi/model/machine_configuration_collection.rb
> new file mode 100644
> index 0000000..a8adf9d
> --- /dev/null
> +++ b/server/lib/cimi/model/machine_configuration_collection.rb
> @@ -0,0 +1,34 @@
> +# Licensed to the Apache Software Foundation (ASF) under one or more
> +# contributor license agreements.  See the NOTICE file distributed with
> +# this work for additional information regarding copyright ownership.  The
> +# ASF licenses this file to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance with the
> +# License.  You may obtain a copy of the License at
> +#
> +#       http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing, software
> +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> +# License for the specific language governing permissions and limitations
> +# under the License.
> +
> +class CIMI::Model::MachineConfigurationCollection < CIMI::Model::Base
> +
> +  act_as_root_entity :machine_configuration
> +
> +  array :machine_configuration do
> +    scalar :href
> +  end
> +
> +  def self.default(context)
> +    self.new(
> +      :uri => context.machine_configurations_url,
> +      :name => 'default',
> +      :created => Time.now,
> +      :description => "#{context.driver.name.capitalize} MachineConfigurationCollection",
> +      :machine_configuration => MachineConfiguration.all(context).map { |c| { :href
=> c.uri } }
> +    )
> +  end
> +
> +end
> diff --git a/server/lib/cimi/model/machine_image.rb b/server/lib/cimi/model/machine_image.rb
> index 3d75d8f..e9aedf6 100644
> --- a/server/lib/cimi/model/machine_image.rb
> +++ b/server/lib/cimi/model/machine_image.rb
> @@ -15,8 +15,6 @@
>  
>  class CIMI::Model::MachineImage < CIMI::Model::Base
>  
> -  act_as_root_entity
> -
>    href :image_location
>    text :image_data
>  
> diff --git a/server/lib/cimi/model/machine_image_collection.rb b/server/lib/cimi/model/machine_image_collection.rb
> new file mode 100644
> index 0000000..7ce5623
> --- /dev/null
> +++ b/server/lib/cimi/model/machine_image_collection.rb
> @@ -0,0 +1,34 @@
> +# Licensed to the Apache Software Foundation (ASF) under one or more
> +# contributor license agreements.  See the NOTICE file distributed with
> +# this work for additional information regarding copyright ownership.  The
> +# ASF licenses this file to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance with the
> +# License.  You may obtain a copy of the License at
> +#
> +#       http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing, software
> +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> +# License for the specific language governing permissions and limitations
> +# under the License.
> +
> +class CIMI::Model::MachineImageCollection < CIMI::Model::Base
> +
> +  act_as_root_entity :machine_image
> +
> +  array :machine_images do
> +    scalar :href
> +  end
> +
> +  def self.default(context)
> +    self.new(
> +      :uri => context.machine_images_url,
> +      :name => 'default',
> +      :created => Time.now,
> +      :description => "#{context.driver.name.capitalize} MachineImageCollection",
> +      :machine_images => MachineImage.all(context).map { |c| { :href => c.uri
} }
> +    )
> +  end
> +
> +end
> diff --git a/server/lib/cimi/model/machine_template.rb b/server/lib/cimi/model/machine_template.rb
> index ac23933..8a88052 100644
> --- a/server/lib/cimi/model/machine_template.rb
> +++ b/server/lib/cimi/model/machine_template.rb
> @@ -15,8 +15,6 @@
>  
>  class CIMI::Model::MachineTemplate < CIMI::Model::Base
>  
> -  act_as_root_entity
> -
>    href :machine_config
>    href :machine_image
>    href :machine_admin
> diff --git a/server/lib/cimi/model/machine_template_collection.rb b/server/lib/cimi/model/machine_template_collection.rb
> new file mode 100644
> index 0000000..67344d5
> --- /dev/null
> +++ b/server/lib/cimi/model/machine_template_collection.rb
> @@ -0,0 +1,34 @@
> +# Licensed to the Apache Software Foundation (ASF) under one or more
> +# contributor license agreements.  See the NOTICE file distributed with
> +# this work for additional information regarding copyright ownership.  The
> +# ASF licenses this file to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance with the
> +# License.  You may obtain a copy of the License at
> +#
> +#       http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing, software
> +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> +# License for the specific language governing permissions and limitations
> +# under the License.
> +
> +class CIMI::Model::MachineTemplateCollection < CIMI::Model::Base
> +
> +  act_as_root_entity :machine_template
> +
> +  array :machine_template do
> +    scalar :href
> +  end
> +
> +  def self.default(context)
> +    self.new(
> +      :uri => context.machine_template_url,
> +      :name => 'default',
> +      :created => Time.now,
> +      :description => "#{context.driver.name.capitalize} MachineTemplateCollection",
> +      :machine_template => MachineTemplate.all(context).map { |c| { :href => c.uri
} }
> +    )
> +  end
> +
> +end
> diff --git a/server/lib/cimi/model/volume.rb b/server/lib/cimi/model/volume.rb
> index b976027..4c19889 100644
> --- a/server/lib/cimi/model/volume.rb
> +++ b/server/lib/cimi/model/volume.rb
> @@ -15,8 +15,6 @@
>  
>  class CIMI::Model::Volume < CIMI::Model::Base
>  
> -  act_as_root_entity
> -
>    struct :capacity do
>      scalar :quantity
>      scalar :units
> diff --git a/server/lib/cimi/model/volume_collection.rb b/server/lib/cimi/model/volume_collection.rb
> new file mode 100644
> index 0000000..afda19e
> --- /dev/null
> +++ b/server/lib/cimi/model/volume_collection.rb
> @@ -0,0 +1,34 @@
> +# Licensed to the Apache Software Foundation (ASF) under one or more
> +# contributor license agreements.  See the NOTICE file distributed with
> +# this work for additional information regarding copyright ownership.  The
> +# ASF licenses this file to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance with the
> +# License.  You may obtain a copy of the License at
> +#
> +#       http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing, software
> +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> +# License for the specific language governing permissions and limitations
> +# under the License.
> +
> +class CIMI::Model::VolumeCollection < CIMI::Model::Base
> +
> +  act_as_root_entity :volume
> +
> +  array :volume do
> +    scalar :href
> +  end
> +
> +  def self.default(context)
> +    self.new(
> +      :uri => context.volumes_url,
> +      :name => 'default',
> +      :created => Time.now,
> +      :description => "#{context.driver.name.capitalize} VolumeCollection",
> +      :volume => Volume.all(context).map { |c| { :href => c.uri } }
> +    )
> +  end
> +
> +end
> diff --git a/server/lib/cimi/model/volume_configuration.rb b/server/lib/cimi/model/volume_configuration.rb
> index 48fed59..b8f0155 100644
> --- a/server/lib/cimi/model/volume_configuration.rb
> +++ b/server/lib/cimi/model/volume_configuration.rb
> @@ -15,8 +15,6 @@
>  
>  class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
>  
> -  act_as_root_entity
> -
>    text :format
>    struct :capacity do
>      scalar :quantity
> @@ -49,7 +47,7 @@ class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
>  
>    def self.create(size, context)
>      self.new( {
> -                :uri => context.machine_configuration_url(size),
> +                :uri => context.volume_configuration_url(size),
>                  :name => size,
>                  :description => "volume configuration with #{size} GiB",
>                  :created => Time.now.to_s,
> diff --git a/server/lib/cimi/model/volume_configuration_collection.rb b/server/lib/cimi/model/volume_configuration_collection.rb
> new file mode 100644
> index 0000000..3e76c39
> --- /dev/null
> +++ b/server/lib/cimi/model/volume_configuration_collection.rb
> @@ -0,0 +1,34 @@
> +# Licensed to the Apache Software Foundation (ASF) under one or more
> +# contributor license agreements.  See the NOTICE file distributed with
> +# this work for additional information regarding copyright ownership.  The
> +# ASF licenses this file to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance with the
> +# License.  You may obtain a copy of the License at
> +#
> +#       http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing, software
> +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> +# License for the specific language governing permissions and limitations
> +# under the License.
> +
> +class CIMI::Model::VolumeConfigurationCollection < CIMI::Model::Base
> +
> +  act_as_root_entity :volume_configuration
> +
> +  array :volume_configuration do
> +    scalar :href
> +  end
> +
> +  def self.default(context)
> +    self.new(
> +      :uri => context.volume_configurations_url,
> +      :name => 'default',
> +      :created => Time.now,
> +      :description => "#{context.driver.name.capitalize} VolumeConfigurationCollection",
> +      :volume_configuration => VolumeConfiguration.all(context).map { |c| { :href
=> c.uri } }
> +    )
> +  end
> +
> +end
> diff --git a/server/lib/cimi/model/volume_image.rb b/server/lib/cimi/model/volume_image.rb
> index d7b3224..e32509e 100644
> --- a/server/lib/cimi/model/volume_image.rb
> +++ b/server/lib/cimi/model/volume_image.rb
> @@ -15,8 +15,6 @@
>  
>  class CIMI::Model::VolumeImage < CIMI::Model::Base
>  
> -  act_as_root_entity
> -
>    href :image_location
>    text :image_data
>    text :bootable
> diff --git a/server/lib/cimi/model/volume_image_collection.rb b/server/lib/cimi/model/volume_image_collection.rb
> new file mode 100644
> index 0000000..95c63ac
> --- /dev/null
> +++ b/server/lib/cimi/model/volume_image_collection.rb
> @@ -0,0 +1,34 @@
> +# Licensed to the Apache Software Foundation (ASF) under one or more
> +# contributor license agreements.  See the NOTICE file distributed with
> +# this work for additional information regarding copyright ownership.  The
> +# ASF licenses this file to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance with the
> +# License.  You may obtain a copy of the License at
> +#
> +#       http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing, software
> +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> +# License for the specific language governing permissions and limitations
> +# under the License.
> +
> +class CIMI::Model::VolumeImageCollection < CIMI::Model::Base
> +
> +  act_as_root_entity :volume_image
> +
> +  array :volume_image do
> +    scalar :href
> +  end
> +
> +  def self.default(context)
> +    self.new(
> +      :uri => context.volume_images_url,
> +      :name => 'default',
> +      :created => Time.now,
> +      :description => "#{context.driver.name.capitalize} VolumeImageCollection",
> +      :volume_image => VolumeImage.all(context).map { |c| { :href => c.uri } }
> +    )
> +  end
> +
> +end
> diff --git a/server/lib/cimi/model/volume_template.rb b/server/lib/cimi/model/volume_template.rb
> index aa12435..b9c82db 100644
> --- a/server/lib/cimi/model/volume_template.rb
> +++ b/server/lib/cimi/model/volume_template.rb
> @@ -15,8 +15,6 @@
>  
>  class CIMI::Model::VolumeTemplate < CIMI::Model::Base
>  
> -  act_as_root_entity
> -
>    href :volume_config
>    href :volume_image
>    array :operations do
> diff --git a/server/lib/cimi/model/volume_template_collection.rb b/server/lib/cimi/model/volume_template_collection.rb
> new file mode 100644
> index 0000000..35c8ae0
> --- /dev/null
> +++ b/server/lib/cimi/model/volume_template_collection.rb
> @@ -0,0 +1,34 @@
> +# Licensed to the Apache Software Foundation (ASF) under one or more
> +# contributor license agreements.  See the NOTICE file distributed with
> +# this work for additional information regarding copyright ownership.  The
> +# ASF licenses this file to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance with the
> +# License.  You may obtain a copy of the License at
> +#
> +#       http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing, software
> +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> +# License for the specific language governing permissions and limitations
> +# under the License.
> +
> +class CIMI::Model::VolumeTemplateCollection < CIMI::Model::Base
> +
> +  act_as_root_entity :volume_template
> +
> +  array :volume_template do
> +    scalar :href
> +  end
> +
> +  def self.default(context)
> +    self.new(
> +      :uri => context.volume_template_url,
> +      :name => 'default',
> +      :created => Time.now,
> +      :description => "#{context.driver.name.capitalize} VolumeTemplateCollection",
> +      :volume_template => VolumeTemplate.all(context).map { |c| { :href => c.uri
} }
> +    )
> +  end
> +
> +end
> diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
> index 1e85d0f..ac7d51f 100644
> --- a/server/lib/cimi/server.rb
> +++ b/server/lib/cimi/server.rb
> @@ -94,10 +94,10 @@ global_collection :machine_configurations do
>    operation :index do
>      description "List all machine configurations"
>      control do
> -      machine_configs = MachineConfiguration.all(self)
> +      machine_configs = MachineConfigurationCollection.default(self)
>        respond_to do |format|
> -        format.xml { machine_configs.to_xml_cimi_collection(self) }
> -        format.json { machine_configs.to_json_cimi_collection(self) }
> +        format.xml { machine_configs.to_xml }
> +        format.json { machine_configs.to_json }
>        end
>      end
>    end
> @@ -126,10 +126,10 @@ global_collection :machine_images do
>    operation :index do
>      description "List all machine configurations"
>      control do
> -      machine_images = MachineImage.all(self)
> +      machine_images = MachineImageCollection.default(self)
>        respond_to do |format|
> -        format.xml { machine_images.to_xml_cimi_collection(self) }
> -        format.json { machine_images.to_json_cimi_collection(self) }
> +        format.xml { machine_images.to_xml }
> +        format.json { machine_images.to_json }
>        end
>      end
>    end
> @@ -155,10 +155,10 @@ global_collection :machines do
>    operation :index do
>      description "List all machines"
>      control do
> -      machines = Machine.all(self)
> +      machines = MachineCollection.default(self)
>        respond_to do |format|
> -        format.xml { machines.to_xml_cimi_collection(self) }
> -        format.json { machines.to_json_cimi_collection(self) }
> +        format.xml { machines.to_xml }
> +        format.json { machines.to_json }
>        end
>      end
>    end
> @@ -260,10 +260,10 @@ global_collection :volumes do
>    operation :index do
>      description "List all volumes"
>      control do
> -      volumes = Volume.all(self)
> +      volumes = VolumeCollection.default(self)
>        respond_to do |format|
> -        format.xml { volumes.to_xml_cimi_collection(self) }
> -        format.json { volumes.to_json_cimi_collection(self) }
> +        format.xml { volumes.to_xml }
> +        format.json { volumes.to_json }
>        end
>      end
>    end
> @@ -318,10 +318,10 @@ global_collection :volume_configurations do
>    operation :index do
>      description "Get list all VolumeConfigurations"
>      control do
> -      volume_configs = VolumeConfiguration.all(self)
> +      volume_configuration = VolumeConfigurationCollection.default(self)
>        respond_to do |format|
> -        format.xml { volume_configs.to_xml_cimi_collection(self) }
> -        format.json { volume_configs.to_json_cimi_collection(self) }
> +        format.xml { volume_configuration.to_xml }
> +        format.json { volume_configuration.to_json }
>        end
>      end
>    end
> @@ -344,10 +344,10 @@ global_collection :volume_images do
>    operation :index do
>      description "List all volumes images"
>      control do
> -      volume_images = VolumeImage.all(self)
> +      volume_images = VolumeImageCollection.default(self)
>        respond_to do |format|
> -        format.xml { volume_images.to_xml_cimi_collection(self) }
> -        format.json { volume_images.to_json_cimi_collection(self) }
> +        format.xml { volume_images.to_xml }
> +        format.json { volume_images.to_json }
>        end
>      end
>    end


Mime
View raw message