Sha256: c3f717cd58c6bf1c2a340d858c8d644164f95c4dca594ea804a346f93a730ea2

Contents?: true

Size: 1021 Bytes

Versions: 38

Compression:

Stored size: 1021 Bytes

Contents

module Fog
  module Compute
    class AzureRM
      # Real class for Compute Request
      class Real
        def grant_access_to_managed_disk(resource_group_name, disk_name, access_type, duration_in_sec)
          msg = "Granting access to Managed Disk: #{disk_name}"
          Fog::Logger.debug msg
          access_data = Azure::ARM::Compute::Models::GrantAccessData.new
          access_data.access = access_type
          access_data.duration_in_seconds = duration_in_sec
          begin
            access_uri = @compute_mgmt_client.disks.grant_access(resource_group_name, disk_name, access_data)
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, msg)
          end
          Fog::Logger.debug "Access granted to managed disk: #{disk_name} successfully."
          access_uri.access_sas
        end
      end

      # Mock class for Compute Request
      class Mock
        def grant_access_to_managed_disk(*)
          'ACCESS URI'
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 4 rubygems

Version Path
fog-azure-rm-0.6.0 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.5.3 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.5.2 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
far-gem-0.5.6 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.5.1 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
far-gem-0.5.5 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.5.0 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
far-gem-0.5.4 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
far-gem-0.5.3 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.4.9 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
far-gem-0.5.2 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.4.8 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.4.7 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.4.6 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.4.5 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-temp-0.0.5 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.4.4 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.4.3 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
far-gem-0.5.1 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb
fog-azure-rm-0.4.2 lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb