Sha256: c8e90426a8af2ce2ada8674bb67c5f4d3bb32b57aaa9cd6bac39a04617601183

Contents?: true

Size: 1 KB

Versions: 36

Compression:

Stored size: 1 KB

Contents

module Azure
  module Armrest
    class VirtualMachine < BaseModel
      # Indicates whether the VM is backed by a managed disk or a regular
      # storage account.
      #
      def managed_disk?
        check_for_model_view('managed_disk?')
        properties.storage_profile.os_disk.try(:managed_disk) ? true : false
      end

      # Returns the size (aka series) for the VM, e.g. "Standard_A0".
      #
      def size
        check_for_model_view('size')
        properties.hardware_profile.vm_size
      end

      alias flavor size

      # The operating system for the image, e.g. "Linux" or "Windows".
      #
      def operating_system
        check_for_model_view('operating_sytem')
        properties.storage_profile.os_disk.os_type
      end

      alias os operating_system

      private

      def check_for_model_view(method_name)
        unless respond_to?(:properties)
          raise NoMethodError, "The method '#{method_name}' is only valid for model view objects."
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
azure-armrest-0.15.0 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.14.0 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.13.1 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.13.0 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.12.0 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.11.0 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.16 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.10.0 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.15 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.14 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.13 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.12 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.11 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.10 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.9 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.8 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.7 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.6 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.5 lib/azure/armrest/model/virtual_machine.rb
azure-armrest-0.9.4 lib/azure/armrest/model/virtual_machine.rb