Sha256: a42921b9e9dc0720107a5f6a8e79d3ea03be34d204f40e08fad546c1735dd861

Contents?: true

Size: 1000 Bytes

Versions: 3

Compression:

Stored size: 1000 Bytes

Contents

require 'fog/core/collection'
require 'fog/azurerm/models/network/load_balancer'

module Fog
  module Network
    class AzureRM
      # LoadBalancers collection class for Network Service
      class LoadBalancers < Fog::Collection
        model Fog::Network::AzureRM::LoadBalancer
        attribute :resource_group

        def all
          requires :resource_group
          load_balancers = []
          service.list_load_balancers(resource_group).each do |load_balancer|
            load_balancers << Fog::Network::AzureRM::LoadBalancer.parse(load_balancer)
          end
          load(load_balancers)
        end

        def get(resource_group_name, load_balancer_name)
          lb = service.get_load_balancer(resource_group_name, load_balancer_name)
          load_balancer = Fog::Network::AzureRM::LoadBalancer.new(service: service)
          load_balancer.merge_attributes(Fog::Network::AzureRM::LoadBalancer.parse(lb))
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.9 lib/fog/azurerm/models/network/load_balancers.rb
fog-azure-rm-0.0.8 lib/fog/azurerm/models/network/load_balancers.rb
fog-azure-rm-0.0.6 lib/fog/azurerm/models/network/load_balancers.rb