Sha256: 03f2d533f26428bfa5fa5c970b48bfa51fe4d5108c69f9462f47472deb843eb8

Contents?: true

Size: 1.84 KB

Versions: 4

Compression:

Stored size: 1.84 KB

Contents

module Fog
  module Compute
    class AzureRM
      # Real class for Compute Request
      class Real
        def get_vm_extension(resource_group_name, virtual_machine_name, vm_extension_name)
          msg = "Getting Extension #{vm_extension_name} of Virtual Machine #{virtual_machine_name} in Resource Group #{resource_group_name}"
          Fog::Logger.debug msg
          begin
            vm_extension = @compute_mgmt_client.virtual_machine_extensions.get(resource_group_name, virtual_machine_name, vm_extension_name)
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, msg)
          end
          Fog::Logger.debug "#{msg} successful"
          vm_extension
        end
      end

      # Mock class for Compute Request
      class Mock
        def get_vm_extension(*)
          body = {
            'id' => '/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Compute/virtualMachines/TestVM/extensions/IaaSAntimalware',
            'name' => 'IaasAntimalware',
            'resource_group' => 'fog-test-rg',
            'location' => 'West US',
            'properties' => {
              'publisher' => 'Microsoft.Azure.Security',
              'type' => 'IaaSAntimalware',
              'typeHandlerVersion' => '1.3',
              'autoUpgradeMinorVersion' => 'true',
              'forceUpdateTag' => 'RerunExtension',
              'settings' => {
                'AnitmalwareEnabled' => 'true',
                'RealtimeProtectionEnabled' => 'false'
              },
              'protected_settings' => {}
            }
          }
          extension_mapper = Azure::ARM::Compute::Models::VirtualMachineExtension.mapper
          @compute_mgmt_client.deserialize(extension_mapper, body, 'result.body')
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 lib/fog/azurerm/requests/compute/get_vm_extension.rb
fog-azure-rm-0.1.0 lib/fog/azurerm/requests/compute/get_vm_extension.rb
fog-azure-rm-0.0.9 lib/fog/azurerm/requests/compute/get_vm_extension.rb
fog-azure-rm-0.0.8 lib/fog/azurerm/requests/compute/get_vm_extension.rb