From 386ee9f13806fca38656bd429a4241bb3d5513d3 Mon Sep 17 00:00:00 2001 From: Paul Thornthwaite Date: Mon, 22 Aug 2011 17:41:18 +0100 Subject: [PATCH] [compute|brightbox] Updated and reordered model attributes --- lib/fog/compute/models/brightbox/account.rb | 17 ++++++++++----- lib/fog/compute/models/brightbox/cloud_ip.rb | 6 ++++-- lib/fog/compute/models/brightbox/flavor.rb | 7 +++---- lib/fog/compute/models/brightbox/image.rb | 21 ++++++++++++------- .../compute/models/brightbox/load_balancer.rb | 16 ++++++++++---- lib/fog/compute/models/brightbox/server.rb | 17 +++++++++------ lib/fog/compute/models/brightbox/user.rb | 10 ++++++--- lib/fog/compute/models/brightbox/zone.rb | 7 ++++--- 8 files changed, 66 insertions(+), 35 deletions(-) diff --git a/lib/fog/compute/models/brightbox/account.rb b/lib/fog/compute/models/brightbox/account.rb index d91aff526..d4b79878a 100644 --- a/lib/fog/compute/models/brightbox/account.rb +++ b/lib/fog/compute/models/brightbox/account.rb @@ -7,10 +7,12 @@ module Fog class Account < Fog::Model identity :id - attribute :resource_type attribute :url + attribute :resource_type + attribute :name attribute :status + attribute :address_1 attribute :address_2 attribute :city @@ -20,11 +22,8 @@ module Fog attribute :country_name attribute :vat_registration_number attribute :telephone_number - attribute :telephone_verified attribute :verified_telephone - attribute :verified_at, :type => :time attribute :verified_ip - attribute :valid_credit_card, :type => :boolean attribute :ram_limit attribute :ram_used attribute :cloud_ips_limit @@ -35,8 +34,16 @@ module Fog attribute :library_ftp_user # This is always returned as null/nil unless performing a reset_ftp_password request attribute :library_ftp_password - attribute :created_at, :type => :time + # Boolean flags + attribute :valid_credit_card + attribute :telephone_verified + + # Times + attribute :created_at + attribute :verified_at + + # Links - to be replaced attribute :owner_id, :aliases => "owner", :squash => "id" attribute :clients attribute :images diff --git a/lib/fog/compute/models/brightbox/cloud_ip.rb b/lib/fog/compute/models/brightbox/cloud_ip.rb index ce678cad2..0636f1e19 100644 --- a/lib/fog/compute/models/brightbox/cloud_ip.rb +++ b/lib/fog/compute/models/brightbox/cloud_ip.rb @@ -7,19 +7,21 @@ module Fog class CloudIp < Fog::Model identity :id - attribute :url + attribute :resource_type + attribute :name attribute :status - attribute :resource_type attribute :description attribute :reverse_dns attribute :public_ip + # Links - to be replaced attribute :account_id, :aliases => "account", :squash => "id" attribute :interface_id, :aliases => "interface", :squash => "id" attribute :server_id, :aliases => "server", :squash => "id" + attribute :load_balancer, :alias => "load_balancer", :squash => "id" def map(interface_to_map) requires :identity diff --git a/lib/fog/compute/models/brightbox/flavor.rb b/lib/fog/compute/models/brightbox/flavor.rb index 8d1ecefa1..1613b29fe 100644 --- a/lib/fog/compute/models/brightbox/flavor.rb +++ b/lib/fog/compute/models/brightbox/flavor.rb @@ -7,10 +7,12 @@ module Fog class Flavor < Fog::Model identity :id - attribute :url + attribute :resource_type + attribute :name attribute :status + attribute :description attribute :handle @@ -19,9 +21,6 @@ module Fog attribute :disk, :aliases => "disk_size" attribute :ram - attribute :resource_type - attribute :description - def bits 0 # This is actually based on the Image type used. 32bit or 64bit Images are supported end diff --git a/lib/fog/compute/models/brightbox/image.rb b/lib/fog/compute/models/brightbox/image.rb index c72269ecb..3fd28d5e5 100644 --- a/lib/fog/compute/models/brightbox/image.rb +++ b/lib/fog/compute/models/brightbox/image.rb @@ -7,26 +7,31 @@ module Fog class Image < Fog::Model identity :id - attribute :url + attribute :resource_type + attribute :name attribute :status + attribute :description + attribute :source attribute :source_type - - attribute :ancestor_id, :aliases => "ancestor", :squash => "id" - attribute :owner_id, :aliases => "owner", :squash => "id" attribute :arch + attribute :virtual_size + attribute :disk_size - attribute :resource_type - attribute :description + # Boolean flags attribute :public attribute :official attribute :compatibility_mode - attribute :virtual_size - attribute :disk_size + + # Times attribute :created_at + # Links - to be replaced + attribute :ancestor_id, :aliases => "ancestor", :squash => "id" + attribute :owner_id, :aliases => "owner", :squash => "id" + def ready? status == "available" end diff --git a/lib/fog/compute/models/brightbox/load_balancer.rb b/lib/fog/compute/models/brightbox/load_balancer.rb index 54bff7727..706e73da6 100644 --- a/lib/fog/compute/models/brightbox/load_balancer.rb +++ b/lib/fog/compute/models/brightbox/load_balancer.rb @@ -7,17 +7,25 @@ module Fog class LoadBalancer < Fog::Model identity :id - attribute :url - attribute :name - attribute :status attribute :resource_type - attribute :nodes + attribute :name + attribute :status + attribute :policy + attribute :nodes attribute :healthcheck attribute :listeners + + # Times + attribute :created_at + attribute :deleted_at + + # Links - to be replaced attribute :account + attribute :server + attribute :cloud_ip def ready? status == 'active' diff --git a/lib/fog/compute/models/brightbox/server.rb b/lib/fog/compute/models/brightbox/server.rb index cefa2a7aa..6fcfaa16d 100644 --- a/lib/fog/compute/models/brightbox/server.rb +++ b/lib/fog/compute/models/brightbox/server.rb @@ -7,23 +7,28 @@ module Fog class Server < Fog::Compute::Server identity :id - + attribute :resource_type attribute :url + attribute :name attribute :state, :aliases => 'status' + attribute :hostname - attribute :created_at, :type => :time - attribute :deleted_at, :type => :time - attribute :started_at, :type => :time attribute :user_data + attribute :console_url + attribute :console_token - attribute :resource_type + # Times + attribute :created_at + attribute :started_at + attribute :console_token_expires + attribute :deleted_at + # Links - to be replaced attribute :account_id, :aliases => "account", :squash => "id" attribute :image_id, :aliases => "image", :squash => "id" attribute :flavor_id, :aliases => "server_type", :squash => "id" attribute :zone_id, :aliases => "zone", :squash => "id" - attribute :snapshots attribute :cloud_ips attribute :interfaces diff --git a/lib/fog/compute/models/brightbox/user.rb b/lib/fog/compute/models/brightbox/user.rb index 39b62cd15..5b4c86de2 100644 --- a/lib/fog/compute/models/brightbox/user.rb +++ b/lib/fog/compute/models/brightbox/user.rb @@ -7,14 +7,18 @@ module Fog class User < Fog::Model identity :id - - attribute :url attribute :resource_type + attribute :url + attribute :name attribute :email_address - attribute :email_verified attribute :ssh_key + # Boolean flags + attribute :email_verified + attribute :messaging_pref + + # Links - to be replaced attribute :account_id, :aliases => "default_account", :squash => "id" attribute :accounts diff --git a/lib/fog/compute/models/brightbox/zone.rb b/lib/fog/compute/models/brightbox/zone.rb index 04eb0e4c4..4e0b6b17c 100644 --- a/lib/fog/compute/models/brightbox/zone.rb +++ b/lib/fog/compute/models/brightbox/zone.rb @@ -7,11 +7,12 @@ module Fog class Zone < Fog::Model identity :id - attribute :url - attribute :handle - attribute :status attribute :resource_type + + attribute :status + attribute :handle + attribute :description end