deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [3/15] git commit: CIMI (Collection): advertise 'add' operation if supported
Date Thu, 08 Nov 2012 17:13:51 GMT
CIMI (Collection): advertise 'add' operation if supported


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/69f21079
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/69f21079
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/69f21079

Branch: refs/heads/master
Commit: 69f21079cbda879e28ab39f7dfffd1d7ab2dfd87
Parents: a9215fc
Author: David Lutterkort <lutter@redhat.com>
Authored: Tue Nov 6 17:15:19 2012 -0800
Committer: David Lutterkort <lutter@redhat.com>
Committed: Thu Nov 8 09:11:18 2012 -0800

----------------------------------------------------------------------
 server/lib/cimi/models/collection.rb |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/69f21079/server/lib/cimi/models/collection.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/collection.rb b/server/lib/cimi/models/collection.rb
index 48c9ccb..49c36ff 100644
--- a/server/lib/cimi/models/collection.rb
+++ b/server/lib/cimi/models/collection.rb
@@ -115,9 +115,16 @@ module CIMI::Model
         entries = find(:all, context)
         desc = "#{self.name.split("::").last} Collection for the #{context.driver.name.capitalize}
driver"
         id = context.send("#{collection_class.entry_name}_url")
+        ops = []
+        create = "create_#{collection_class.entry_name.to_s.singularize}_url"
+        if context.respond_to?(create)
+          url = context.send(create)
+          ops << { :rel => "add", :href => url }
+        end
         collection_class.new(:id => id, :name => 'default',
                              :count => entries.size,
                              :entries => entries,
+                             :operations => ops,
                              :description => desc)
       end
     end


Mime
View raw message