Sha256: 997cbed0b62ca562af35c34f154b1c81fed4304cd8e07a6ba2ce485ef44321f9

Contents?: true

Size: 1.45 KB

Versions: 11

Compression:

Stored size: 1.45 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class Brightbox

      class CloudIp < Fog::Model

        identity :id
        attribute :url
        attribute :resource_type

        attribute :name
        attribute :status
        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"
        attribute :port_translators
        attribute :name

        def map(destination)
          requires :identity
          case destination
          when Fog::Compute::Brightbox::Server
            final_destination = destination.interfaces.first["id"]
          when Fog::Compute::Brightbox::LoadBalancer
            final_destination = destination.id
          else
            final_destination = destination
          end
          connection.map_cloud_ip(identity, :destination => final_destination)
        end

        def mapped?
          status == "mapped"
        end

        def unmap
          requires :identity
          connection.unmap_cloud_ip(identity)
        end

        def destroy
          requires :identity
          connection.destroy_cloud_ip(identity)
        end

      end

    end
  end
end

Version data entries

11 entries across 11 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-nirvanix-1.8.1 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-parser-fix-1.6.1 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-test-again-1.6.0 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-parser-fix-1.6.0 lib/fog/brightbox/models/compute/cloud_ip.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/brightbox/models/compute/cloud_ip.rb
fog-sgonyea-1.8.1 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.8.0 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.7.0 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.6.0 lib/fog/brightbox/models/compute/cloud_ip.rb