deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/2] git commit: Core: Added 'href' attribute to JSON output (DTACLOUD-418)
Date Mon, 28 Jan 2013 17:48:04 GMT
Core: Added 'href' attribute to JSON output (DTACLOUD-418)


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

Branch: refs/heads/master
Commit: 3dd359bf7ebc6c634c89f489424be7d7dc266b3c
Parents: 00244c1
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed Jan 16 13:20:05 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Mon Jan 28 18:42:36 2013 +0100

----------------------------------------------------------------------
 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(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/address.rb
----------------------------------------------------------------------
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?

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/blob.rb
----------------------------------------------------------------------
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,

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/bucket.rb
----------------------------------------------------------------------
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 }}

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/firewall.rb
----------------------------------------------------------------------
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,

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/hardware_profile.rb
----------------------------------------------------------------------
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?

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/image.rb
----------------------------------------------------------------------
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,

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/instance.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/models/instance.rb b/server/lib/deltacloud/models/instance.rb
index 0fd6b13..af47204 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,

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/key.rb
----------------------------------------------------------------------
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,

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/load_balancer.rb
----------------------------------------------------------------------
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) },

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/metric.rb
----------------------------------------------------------------------
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) }
     }

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/realm.rb
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/storage_snapshot.rb
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3dd359bf/server/lib/deltacloud/models/storage_volume.rb
----------------------------------------------------------------------
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,


Mime
View raw message