Sha256: dceadac7f2973f367b63f71d3f75f722545777587c0bcc637faec0b4f25bcedf

Contents?: true

Size: 1.39 KB

Versions: 17

Compression:

Stored size: 1.39 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"

        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

17 entries across 17 versions & 6 rubygems

Version Path
fog-1.5.0 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.4.0 lib/fog/brightbox/models/compute/cloud_ip.rb
michiels-fog-1.3.1 lib/fog/brightbox/models/compute/cloud_ip.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.3.1 lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.3.0 lib/fog/brightbox/models/compute/cloud_ip.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.2.0 lib/fog/brightbox/models/compute/cloud_ip.rb
ktheory-fog-1.1.2 lib/fog/brightbox/models/compute/cloud_ip.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/cloud_ip.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/cloud_ip.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/cloud_ip.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/cloud_ip.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/cloud_ip.rb
fog-1.1.2 lib/fog/brightbox/models/compute/cloud_ip.rb
fog_tractical-1.1.4 lib/fog/brightbox/models/compute/cloud_ip.rb
fog_tractical-1.1.3 lib/fog/brightbox/models/compute/cloud_ip.rb