You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by lu...@redhat.com on 2012/11/08 05:05:32 UTC
[PATCH 06/10] CIMI (Collection): advertise 'add' operation if supported
From: David Lutterkort <lu...@redhat.com>
---
server/lib/cimi/models/collection.rb | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
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
--
1.7.7.6