GoGrid collections working. What weird JSON.

This commit is contained in:
John E. Vincent 2010-10-12 10:53:24 +08:00 committed by Wesley Beary
parent 26a3172222
commit 56b114d5c7
5 changed files with 61 additions and 34 deletions

View File

@ -34,6 +34,8 @@ module Fog
:aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
:bluebox_api_key: INTENTIONALLY_LEFT_BLANK
:bluebox_customer_id: INTENTIONALLY_LEFT_BLANK
:go_grid_api_key: INTENTIONALLY_LEFT_BLANK
:go_grid_shared_secret: INTENTIONALLY_LEFT_BLANK
:local_root: INTENTIONALLY_LEFT_BLANK
:new_servers_password: INTENTIONALLY_LEFT_BLANK
:new_servers_username: INTENTIONALLY_LEFT_BLANK

View File

@ -6,9 +6,14 @@ module Fog
requires :go_grid_shared_secret
model_path 'fog/go_grid/models/compute'
model :image
collection :images
model :server
collection :servers
request_path 'fog/go_grid/requests/compute'
request :common_lookup_list
request :grid_image_get
request :grid_image_list
request :grid_ip_list
request :grid_loadbalancer_list

View File

@ -9,10 +9,23 @@ module Fog
identity :id
attribute :name
attribute :description
attribute :friendly_name, :aliases => 'friendlyName'
attribute :created_at, :aliases => 'createdTime'
attribute :updated_at, :aliases => 'updatedTime'
attribute :server_id, :aliases => 'id'
attribute :state
attribute :price
attribute :location
attribute :billingtokens
attribute :os
attribute :architecture
attribute :type
attribute :active, :aliases => 'isActive'
attribute :public, :aliases => 'isPublic'
attribute :object_type, :aliases => 'object'
attribute :owner
def server=(new_server)
requires :id

View File

@ -14,10 +14,14 @@ module Fog
def all
data = connection.grid_image_list.body['list']
load(data)
if server
self.replace(self.select {|image| image.server_id == server.id})
end
end
def get(image_id)
response = connection.grid_image_get.body['list'][image_id]
new(data)
rescue Fog::GoGrid::Compute::NotFound
nil
end

View File

@ -51,3 +51,6 @@ module Fog
end
end
end
end