Sha256: 9dbeb19965aef42b6bf329a985dc3cf385af0c24c268e90cfea0883d1a54aff2

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class Brightbox

      class LoadBalancer < Fog::Model

        identity :id

        attribute :url
        attribute :name
        attribute :status
        attribute :resource_type

        attribute :nodes
        attribute :policy
        attribute :healthcheck
        attribute :listeners
        attribute :account

        def ready?
          status == 'active'
        end

        def save
          requires :nodes, :listeners, :healthcheck
          options = {
            :nodes => nodes,
            :listeners => listeners,
            :healthcheck => healthcheck,
            :policy => policy,
            :name => name
          }.delete_if {|k,v| v.nil? || v == "" }
          data = connection.create_load_balancer(options)
          merge_attributes(data)
          true
        end

        def destroy
          requires :identity
          connection.destroy_load_balancer(identity)
          true
        end

      end

    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
fog-0.11.0 lib/fog/compute/models/brightbox/load_balancer.rb
fog-0.10.0 lib/fog/compute/models/brightbox/load_balancer.rb
fog4encbs-0.9.0.1 lib/fog/compute/models/brightbox/load_balancer.rb
fog4encbs-0.9.0 lib/fog/compute/models/brightbox/load_balancer.rb
fog-0.9.0 lib/fog/compute/models/brightbox/load_balancer.rb