From: Michal Fojtik <mfoj...@redhat.com>
Signed-off-by: Michal fojtik <mfoj...@redhat.com> --- server/lib/deltacloud/models/address.rb | 1 + server/lib/deltacloud/models/blob.rb | 1 + server/lib/deltacloud/models/bucket.rb | 1 + server/lib/deltacloud/models/firewall.rb | 1 + server/lib/deltacloud/models/hardware_profile.rb | 1 + server/lib/deltacloud/models/image.rb | 1 + server/lib/deltacloud/models/instance.rb | 1 + server/lib/deltacloud/models/key.rb | 1 + server/lib/deltacloud/models/load_balancer.rb | 1 + server/lib/deltacloud/models/metric.rb | 1 + server/lib/deltacloud/models/realm.rb | 1 + server/lib/deltacloud/models/storage_snapshot.rb | 1 + server/lib/deltacloud/models/storage_volume.rb | 1 + 13 files changed, 13 insertions(+) diff --git a/server/lib/deltacloud/models/address.rb b/server/lib/deltacloud/models/address.rb index f91b856..ce63524 100644 --- a/server/lib/deltacloud/models/address.rb +++ b/server/lib/deltacloud/models/address.rb @@ -28,6 +28,7 @@ class Address < BaseModel def to_hash(context) r = { :id => self.id, + :href => context.address_url(self.id), :associated => associated? } r[:instance_id] = instance_id if associated? diff --git a/server/lib/deltacloud/models/blob.rb b/server/lib/deltacloud/models/blob.rb index a785d6a..e3a01ed 100644 --- a/server/lib/deltacloud/models/blob.rb +++ b/server/lib/deltacloud/models/blob.rb @@ -27,6 +27,7 @@ class Blob < BaseModel def to_hash(context) { :id => self.id, + :href => context.bucket_url(bucket) + '/' + self.id, :bucket => { :rel => :bucket, :href => context.bucket_url(bucket), :id => bucket }, :content_length => content_length, :content_type => content_type, diff --git a/server/lib/deltacloud/models/bucket.rb b/server/lib/deltacloud/models/bucket.rb index eab4a69..5ec3537 100644 --- a/server/lib/deltacloud/models/bucket.rb +++ b/server/lib/deltacloud/models/bucket.rb @@ -27,6 +27,7 @@ class Bucket < BaseModel def to_hash(context) { :id => self.id, + :href => context.bucket_url(self.id), :name => name, :size => size, :blob_list => blob_list.map { |b| { :rel => :blob, :href => context.url("/buckets/#{self.id}/#{b}"), :id => b }} diff --git a/server/lib/deltacloud/models/firewall.rb b/server/lib/deltacloud/models/firewall.rb index c7003b8..7d139af 100644 --- a/server/lib/deltacloud/models/firewall.rb +++ b/server/lib/deltacloud/models/firewall.rb @@ -23,6 +23,7 @@ class Firewall < BaseModel def to_hash(context) r = { :id => self.id, + :href => context.firewall_url(self.id), :name => name, :description => description, :owner_id => owner_id, diff --git a/server/lib/deltacloud/models/hardware_profile.rb b/server/lib/deltacloud/models/hardware_profile.rb index 8dff2ca..5b4aa4e 100644 --- a/server/lib/deltacloud/models/hardware_profile.rb +++ b/server/lib/deltacloud/models/hardware_profile.rb @@ -88,6 +88,7 @@ module Deltacloud def to_hash(context) r = { :id => self.id, + :href => context.hardware_profile_url(self.id), :name => name, } r.merge!({:properties => @properties}) if !@properties.empty? diff --git a/server/lib/deltacloud/models/image.rb b/server/lib/deltacloud/models/image.rb index 19a309c..551d861 100644 --- a/server/lib/deltacloud/models/image.rb +++ b/server/lib/deltacloud/models/image.rb @@ -28,6 +28,7 @@ class Image < BaseModel def to_hash(context) { :id => self.id, + :href => context.image_url(self.id), :name => name, :description => description, :owner => owner_id, diff --git a/server/lib/deltacloud/models/instance.rb b/server/lib/deltacloud/models/instance.rb index fcfe092..70abc08 100644 --- a/server/lib/deltacloud/models/instance.rb +++ b/server/lib/deltacloud/models/instance.rb @@ -41,6 +41,7 @@ class Instance < BaseModel def to_hash(context) r = { :id => self.id, + :href => context.instance_url(self.id), :name => name, :state => state, :owner => owner_id, diff --git a/server/lib/deltacloud/models/key.rb b/server/lib/deltacloud/models/key.rb index f69ee68..64492fb 100644 --- a/server/lib/deltacloud/models/key.rb +++ b/server/lib/deltacloud/models/key.rb @@ -54,6 +54,7 @@ class Key < BaseModel def to_hash(context) r = { :id => self.id, + :href => context.key_url(self.id), :credential_type => credential_type, :username => username, :password => password, diff --git a/server/lib/deltacloud/models/load_balancer.rb b/server/lib/deltacloud/models/load_balancer.rb index dfd6ae0..d604455 100644 --- a/server/lib/deltacloud/models/load_balancer.rb +++ b/server/lib/deltacloud/models/load_balancer.rb @@ -30,6 +30,7 @@ class LoadBalancer < BaseModel def to_hash(context) { :id => self.id, + :href => context.load_balancer_url(self.id), :realms => realms, :listeners => listeners.map { |l| l.to_hash(context) }, :instances => instances.map { |i| i.to_hash(context) }, diff --git a/server/lib/deltacloud/models/metric.rb b/server/lib/deltacloud/models/metric.rb index 05609d3..7970565 100644 --- a/server/lib/deltacloud/models/metric.rb +++ b/server/lib/deltacloud/models/metric.rb @@ -32,6 +32,7 @@ class Metric < BaseModel def to_hash(context) { :id => self.id, + :href => context.matric_url(self.id), :entity => entity, :properties => properties.map { |p| p.to_hash(context) } } diff --git a/server/lib/deltacloud/models/realm.rb b/server/lib/deltacloud/models/realm.rb index dab6d01..00dd36f 100644 --- a/server/lib/deltacloud/models/realm.rb +++ b/server/lib/deltacloud/models/realm.rb @@ -24,6 +24,7 @@ class Realm < BaseModel def to_hash(context) { :id => self.id, + :href => context.realm_url(self.id), :name => name, :state => state, :limit => limit diff --git a/server/lib/deltacloud/models/storage_snapshot.rb b/server/lib/deltacloud/models/storage_snapshot.rb index 0afc87a..c60b055 100644 --- a/server/lib/deltacloud/models/storage_snapshot.rb +++ b/server/lib/deltacloud/models/storage_snapshot.rb @@ -31,6 +31,7 @@ class StorageSnapshot < BaseModel def to_hash(context) { :id => self.id, + :href => context.storage_snapshot_url(self.id), :state => state, :storage_volume => { :id => storage_volume_id, :href => context.storage_volume_url(storage_volume_id), :rel => :storage_volume }, :created => created diff --git a/server/lib/deltacloud/models/storage_volume.rb b/server/lib/deltacloud/models/storage_volume.rb index 477f394..1ec76d6 100644 --- a/server/lib/deltacloud/models/storage_volume.rb +++ b/server/lib/deltacloud/models/storage_volume.rb @@ -31,6 +31,7 @@ class StorageVolume < BaseModel def to_hash(context) r = { :id => self.id, + :href => context.storage_volume_url(self.id), :name => name, :description => description, :state => state, -- 1.8.0.2