Sha256: f68bc114543d72370265c8e3ecc1a7c7c0b0ce8b646c1974f8ad338ce0bfaa84

Contents?: true

Size: 1.51 KB

Versions: 41

Compression:

Stored size: 1.51 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 :server_group, :alias => "server_group", :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
          service.map_cloud_ip(identity, :destination => final_destination)
        end

        def mapped?
          status == "mapped"
        end

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

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

      end

    end
  end
end

Version data entries

41 entries across 41 versions & 6 rubygems

Version Path
fog-maestrodev-1.18.0.20131126183714 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/brightbox/models/compute/cloud_ip.rb
gapinc-fog-1.12.1.2.1 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.18.0 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.17.0 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.16.0 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.15.0 lib/fog/brightbox/models/compute/cloud_ip.rb
gapinc-fog-1.14.0 lib/fog/brightbox/models/compute/cloud_ip.rb