Sha256: f4807a499b99c16acc38d0f2d9ee1d3da3e519100e37a766633a29644e59b1b1

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

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

        def check_vm_exists(resource_group, name)
          service.check_vm_exists(resource_group, name)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-azure-rm-0.2.7 lib/fog/azurerm/models/compute/servers.rb
fog-azure-rm-0.2.6 lib/fog/azurerm/models/compute/servers.rb
fog-azure-rm-0.2.5 lib/fog/azurerm/models/compute/servers.rb
fog-azure-rm-0.2.4 lib/fog/azurerm/models/compute/servers.rb
fog-azure-rm-0.2.3 lib/fog/azurerm/models/compute/servers.rb
fog-azure-rm-0.2.2 lib/fog/azurerm/models/compute/servers.rb
fog-azure-rm-0.2.1 lib/fog/azurerm/models/compute/servers.rb
fog-azure-rm-0.2.0 lib/fog/azurerm/models/compute/servers.rb