Sha256: 0c8f7b10b53741be94e809c5eb2953c51e7e44409e82eedaa3d19705667169df

Contents?: true

Size: 1.33 KB

Versions: 19

Compression:

Stored size: 1.33 KB

Contents

# Azure namespace
module Azure
  # Armrest namespace
  module Armrest
    # Storage namespace
    module Storage
      # Base class for managing managed disks.
      module ManagedStorageHelper
        class ManagedDisk
          def initialize(storage_service, disk_name, resource_group, options)
            @storage_service = storage_service
            @disk_name       = disk_name
            @resource_group  = resource_group
            @sas_url         = storage_service.access_token(disk_name, resource_group, options)
          end

          def read(options = {})
            retries = 0
            begin
              @storage_service.read(@sas_url, options)
            rescue Azure::Armrest::ForbiddenException => err
              raise err if retries.positive?
              log('warn', "ManagedDisk.read: #{err} - getting new SAS URL")
              begin
                close
              rescue => err
                log('debug', "ManagedDisk.read: #{err} received on close ignored.")
              end
              @sas_url = @storage_service.access_token(@disk_name, @resource_group, options)
              retries += 1
              retry
            end
          end

          def close
            @storage_service.close(@disk_name, @resource_group)
            @sas_url = nil
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

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