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
41 42 43 44 45 46 47 48 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 41 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
69 70 71 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 69 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
54 55 56 57 58 59 60 61 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 54 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
64 65 66 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 64 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
74 75 76 77 78 |
# File 'lib/resources/azure/azure_virtual_machine_data_disk.rb', line 74 def has_managed_disks? # iterate around the entries result = entries.each.select { |e| e[:is_managed_disk?] } result.empty? ? false : true end |