Sha256: ada92820e8feea34e3b8ede823f168edd7f73143e5358bfd0976689105121cc1

Contents?: true

Size: 942 Bytes

Versions: 1

Compression:

Stored size: 942 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 Fog::Compute::AzureRM::Server

        def all
          requires :resource_group
          virtual_machines = []
          service.list_virtual_machines(resource_group).each do |vm|
            virtual_machines << Fog::Compute::AzureRM::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_fog = Fog::Compute::AzureRM::Server.new(service: service)
          virtual_machine_fog.merge_attributes(Fog::Compute::AzureRM::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.1 lib/fog/azurerm/models/compute/servers.rb