Sha256: 3f29b93d6094ec2598762d37bd2e993d00fd3946a8a045e82b148fd51739b5a1

Contents?: true

Size: 812 Bytes

Versions: 7

Compression:

Stored size: 812 Bytes

Contents

module Brightbox
  class CloudIP < Api
    def self.get id
      conn.cloud_ips.get id
    end

    def self.all
      conn.cloud_ips
    end

    def self.create
      r = conn.create_cloud_ip
      new(r["id"])
    end

    def attributes
      a = fog_model.attributes
      if(lb_id = a[:load_balancer] || a["load_balancer"])
        a[:destination] = lb_id
      else
        a[:destination] = a[:server_id]
      end
      a
    end

    def to_row
      attributes
    end

    def mapped?
      status == 'mapped'
    end

    def self.default_field_order
      [:id, :status, :public_ip, :destination, :reverse_dns]
    end

    def <=>(b)
      self.status <=> b.status
    end

    def update(options)
      self.class.conn.update_cloud_ip(id, options)
      self.reload
      self
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
brightbox-cli-0.17.5 lib/brightbox-cli/cloud_ips.rb
brightbox-cli-0.17.4 lib/brightbox-cli/cloud_ips.rb
brightbox-cli-0.17.3 lib/brightbox-cli/cloud_ips.rb
brightbox-cli-0.17.2 lib/brightbox-cli/cloud_ips.rb
brightbox-cli-0.17.1 lib/brightbox-cli/cloud_ips.rb
brightbox-cli-0.17.0 lib/brightbox-cli/cloud_ips.rb
brightbox-cli-0.16.0 lib/brightbox-cli/cloud_ips.rb