Sha256: 8ff2e678ad24c940c7bd5c9ac47a96b972ef060ebc6fbdc6f05a5f663a683344

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

module Fog
  module Compute
    class AzureRM
      # This class provides the actual implemention for service calls.
      class Real
        def list_available_sizes_for_virtual_machine(resource_group, name)
          begin
            response = @compute_mgmt_client.virtual_machines.list_available_sizes(resource_group, name)
            result = response.value!
            Azure::ARM::Compute::Models::VirtualMachineSizeListResult.serialize_object(result.body)['value']
          rescue MsRestAzure::AzureOperationError => e
            msg = "Error listing Sizes for Virtual Machine #{name} in Resource Group '#{resource_group}'. #{e.body['error']['message']}"
            raise msg
          end
        end
      end
      # This class provides the mock implementation for unit tests.
      class Mock
        def list_available_sizes_for_virtual_machine(_resource_group, _name)
          [
            {
              'name' => 'Standard_A0',
              'numberOfCores' => 1,
              'osDiskSizeInMB' => 1_047_552,
              'resourceDiskSizeInMB' => 20_480,
              'memoryInMB' => 768,
              'maxDataDiskCount' => 1
            },
            {
              'name' => 'Standard_A1',
              'numberOfCores' => 1,
              'osDiskSizeInMB' => 1_047_552,
              'resourceDiskSizeInMB' => 71_680,
              'memoryInMB' => 1792,
              'maxDataDiskCount' => 2
            },
            {
              'name' => 'Standard_A2',
              'numberOfCores' => 2,
              'osDiskSizeInMB' => 1_047_552,
              'resourceDiskSizeInMB' => 138_240,
              'memoryInMB' => 3584,
              'maxDataDiskCount' => 4
            }
          ]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.4 lib/fog/azurerm/requests/compute/list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.0.3 lib/fog/azurerm/requests/compute/list_available_sizes_for_virtual_machine.rb