lib/azure/armrest/virtual_machine_service.rb
# Deletes any NIC's associated with the VM, and optionally any public IP addresses
# and network security groups.
#
Deletes any NIC's associated with the VM, and optionally any public IP addresses
and network security groups.
Deletes any NIC ' s associated with the VM and optionally any public IP addresses and network security groups .
def delete_associated_nics(vm, options)
        nis = Azure::Armrest::Network::NetworkInterfaceService.new(configuration)
        nics = vm.properties.network_profile.network_interfaces.map(&:id)
        if options[:ip_addresses]
          ips = Azure::Armrest::Network::IpAddressService.new(configuration)
        end
        if options[:network_security_groups]
          nsgs = Azure::Armrest::Network::NetworkSecurityGroupService.new(configuration)
        end
        nics.each do |nic_id_string|
          nic = get_by_id(nic_id_string)
          delete_and_wait(nis, nic.name, nic.resource_group, options)
          if options[:ip_addresses]
            nic.properties.ip_configurations.each do |ipconfig|
              address = ipconfig.properties.try(:public_ip_address)
              if address
                ip = get_by_id(address.id)
                delete_and_wait(ips, ip.name, ip.resource_group, options)
              end
            end
          end
          if options[:network_security_groups]
            if nic.properties.respond_to?(:network_security_group)
              nsg = get_by_id(nic.properties.network_security_group.id)
              delete_and_wait(nsgs, nsg.name, nsg.resource_group, options)
            end
          end
        end
      end
def delete_associated_nics ( vm , options ) nis = Azure :: Armrest :: Network :: NetworkInterfaceService . new ( configuration ) nics = vm . properties . network_profile . network_interfaces . map ( & :id ) if options [ :ip_addresses ] ips = Azure :: Armrest :: Network :: IpAddressService . new ( configuration ) end if options [ :network_security_groups ] nsgs = Azure :: Armrest :: Network :: NetworkSecurityGroupService . new ( configuration ) end nics . each do | nic_id_string | nic = get_by_id ( nic_id_string ) delete_and_wait ( nis , nic . name , nic . resource_group , options ) if options [ :ip_addresses ] nic . properties . ip_configurations . each do | ipconfig | address = ipconfig . properties . try ( :public_ip_address ) if address ip = get_by_id ( address . id ) delete_and_wait ( ips , ip . name , ip . resource_group , options ) end end end if options [ :network_security_groups ] if nic . properties . respond_to? ( :network_security_group ) nsg = get_by_id ( nic . properties . network_security_group . id ) delete_and_wait ( nsgs , nsg . name , nsg . resource_group , options ) end end end end
Deletes any NIC's associated with the VM, and optionally any public IP addresses
and network security groups.
Deletes any NIC ' s associated with the VM and optionally any public IP addresses and network security groups .
vm
<not_specific>
options
<not_specific>