Sha256: b5679da51ed04227f97ea47696aca3d36c489dd891209e00ec0ee3b38fc1fab7

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

module Fog
  module Compute
    class AzureRM
      # This class is giving implementation of all/list, and get
      # for Server.
      class Servers < Fog::Collection
        attribute :resource_group
        model Server

        def all
          requires :resource_group
          virtual_machines = []
          service.list_virtual_machines(resource_group).each do |vm|
            virtual_machines << Server.parse(vm)
          end
          load(virtual_machines)
        end

        def get(resource_group_name, virtual_machine_name)
          virtual_machine = service.get_virtual_machine(resource_group_name, virtual_machine_name)
          virtual_machine_obj = Server.new(service: service)
          virtual_machine_obj.merge_attributes(Server.parse(virtual_machine))
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.0 lib/fog/azurerm/models/compute/servers.rb