Sha256: 81c637dbabe6aaed04c58123a5b32d622472f8de85f7381d08873aceebaedf72

Contents?: true

Size: 1.71 KB

Versions: 38

Compression:

Stored size: 1.71 KB

Contents

module Fog
  module Compute
    class AzureRM
      # This class is giving implementation of all/list, get and
      # check existence for managed disk.
      class ManagedDisks < Fog::Collection
        model Fog::Compute::AzureRM::ManagedDisk
        attribute :resource_group
        def all
          if !resource_group.nil?
            requires :resource_group
            disks = service.list_managed_disks_by_rg(resource_group)
          else
            disks = service.list_managed_disks_in_subscription
          end
          managed_disks = disks.map { |disk| Fog::Compute::AzureRM::ManagedDisk.parse(disk) }

          load(managed_disks)
        end

        def get(resource_group_name, disk_name)
          disk = service.get_managed_disk(resource_group_name, disk_name)
          managed_disk_fog = Fog::Compute::AzureRM::ManagedDisk.new(service: service)
          managed_disk_fog.merge_attributes(Fog::Compute::AzureRM::ManagedDisk.parse(disk))
        end

        def check_managed_disk_exists(resource_group, disk_name)
          service.check_managed_disk_exists(resource_group, disk_name)
        end

        def grant_access(resource_group_name, disk_name, access_type, duration_in_sec)
          service.grant_access_to_managed_disk(resource_group_name, disk_name, access_type, duration_in_sec)
        end

        def revoke_access(resource_group_name, disk_name)
          response = service.revoke_access_to_managed_disk(resource_group_name, disk_name)
          operation_status_response = Fog::Compute::AzureRM::OperationStatusResponse.new(service: service)
          operation_status_response.merge_attributes(Fog::Compute::AzureRM::OperationStatusResponse.parse(response))
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 4 rubygems

Version Path
fog-azure-rm-0.4.1 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.4.0 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.9 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.8 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.7 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.6 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.5 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.4 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-temp-0.0.4 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-temp-0.0.3 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.3 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-temp-0.0.2 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-temp-0.0.1 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.2 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-downgraded-0.3.1 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.1 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-downgraded-0.3.0 lib/fog/azurerm/models/compute/managed_disks.rb
fog-azure-rm-0.3.0 lib/fog/azurerm/models/compute/managed_disks.rb