Sha256: 254ac0d24dcad72eee2aff67e926ad8af4a0f577be6bf4d978e72b3c808f4f0c

Contents?: true

Size: 1.16 KB

Versions: 30

Compression:

Stored size: 1.16 KB

Contents

module Fog
  module Vcloud
    module Terremark
      module Ecloud
        class Node < Fog::Vcloud::Model

          identity :href, :Href

          ignore_attributes :xmlns, :xmlns_i
          
          attribute :ip_address, :aliases => :IpAddress
          attribute :description, :aliases => :Description
          attribute :name, :aliases => :Name
          attribute :port, :aliases => :Port
          attribute :enabled, :aliases => :Enabled
          attribute :id, :aliases => :Id

          def delete
            requires :href

            connection.delete_node( href )
          end

          def save
            if new_record?
              result = connection.add_node( collection.href, _compose_node_data )
              merge_attributes(result.body)
            else
              connection.configure_node( href, _compose_node_data )
            end
          end

          private

          def _compose_node_data
            node_data = {}
            self.class.attributes.select{ |attribute| !send(attribute).nil? }.each { |attribute| node_data[attribute] = send(attribute).to_s }
            node_data
          end

        end
      end
    end
  end
end


Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
fog-0.2.30 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.28 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.27 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.26 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.25 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.24 lib/fog/vcloud/terremark/ecloud/models/node.rb
tecnh-fog-0.2.23.vpc lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.23 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.22 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.21 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.20 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.19 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.18 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.17 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.16 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.15 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.14 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.13 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.12 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.2.11 lib/fog/vcloud/terremark/ecloud/models/node.rb