Class: Inspec::Resources::AzureVirtualMachineDataDisk
- Inherits:
-
AzureResourceBase
- Object
- AzureResourceBase
- Inspec::Resources::AzureVirtualMachineDataDisk
- Defined in:
- lib/resources/azure/azure_virtual_machine_data_disk.rb
Instance Attribute Summary
Attributes inherited from AzureResourceBase
Instance Method Summary collapse
-
#count ⇒ Object
Return an integer stating how many data disks are attached to the machine.
-
#datadisk_details ⇒ Object
Return information about the disks and add to the filter table so that assertions can be performed.
-
#has_data_disks? ⇒ Boolean
Return boolean to denote if the machine has data disks attached or not.
-
#has_managed_disks? ⇒ Boolean
Return boolean to state if the machine is using managed disks for data disks.
-
#initialize(opts = {}) ⇒ AzureVirtualMachineDataDisk
constructor
Constructor for the resource.
Methods inherited from AzureResourceBase
#catch_azure_errors, #create_tag_methods, #failed_resource?, #has_tags?, #resource_group, #resources, #tag_count
Constructor Details
#initialize(opts = {}) ⇒ AzureVirtualMachineDataDisk
Constructor for the resource. This calls the parent constructor to get the generic resource for the specified machine. This will provide static methods that are documented
43 44 45 46 47 48 49 50 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 43 def initialize(opts = {}) # The generic resource needs to pass back a Microsoft.Compute/virtualMachines object so force it opts[:type] = 'Microsoft.Compute/virtualMachines' super(opts) # Get the data disks resources end |
Instance Method Details
#count ⇒ Object
Return an integer stating how many data disks are attached to the machine
71 72 73 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 71 def count entries.count end |
#datadisk_details ⇒ Object
Return information about the disks and add to the filter table so that assertions can be performed
56 57 58 59 60 61 62 63 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 56 def datadisk_details return if failed_resource? # Iterate around the data disks on the machine properties.storageProfile.dataDisks.each_with_index.map do |datadisk, index| # Call function to parse the data disks and return an object based on the parameters parse_datadisk(datadisk, index) end end |
#has_data_disks? ⇒ Boolean
Return boolean to denote if the machine has data disks attached or not
66 67 68 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 66 def has_data_disks? !entries.empty? end |
#has_managed_disks? ⇒ Boolean
Return boolean to state if the machine is using managed disks for data disks
76 77 78 79 80 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 76 def has_managed_disks? # iterate around the entries result = entries.each.select { |e| e[:is_managed_disk?] } result.empty? ? false : true end |