Class: Fog::Compute::AzureRM::ManagedDisks

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/azurerm/models/compute/managed_disks.rb

Overview

This class is giving implementation of all/list, get and check existence for managed disk.

Instance Method Summary collapse

Instance Method Details

#allObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/azurerm/models/compute/managed_disks.rb', line 9

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

#check_managed_disk_exists(resource_group, disk_name) ⇒ Object



27
28
29
# File 'lib/fog/azurerm/models/compute/managed_disks.rb', line 27

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

#get(resource_group_name, disk_name) ⇒ Object



21
22
23
24
25
# File 'lib/fog/azurerm/models/compute/managed_disks.rb', line 21

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

#grant_access(resource_group_name, disk_name, access_type, duration_in_sec) ⇒ Object



31
32
33
# File 'lib/fog/azurerm/models/compute/managed_disks.rb', line 31

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

#revoke_access(resource_group_name, disk_name) ⇒ Object



35
36
37
38
39
# File 'lib/fog/azurerm/models/compute/managed_disks.rb', line 35

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