Sha256: 4b80de6e3796037adc9dd22e5c330bc50a7ad172000f749beb776beef2e4281f

Contents?: true

Size: 1020 Bytes

Versions: 3

Compression:

Stored size: 1020 Bytes

Contents

require 'fog/core/collection'
require 'fog/azurerm/models/compute/server'

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)
          storage_account = service.get_virtual_machine(resource_group_name, virtual_machine_name)
          storage_account_obj = Fog::Compute::AzureRM::Server.new(service: service)
          storage_account_obj.merge_attributes(Fog::Compute::AzureRM::Server.parse(storage_account))
        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/compute/servers.rb
fog-azure-rm-0.0.8 lib/fog/azurerm/models/compute/servers.rb
fog-azure-rm-0.0.6 lib/fog/azurerm/models/compute/servers.rb