Class: Fog::Compute::AzureRM::Mock
- Inherits:
-
Object
- Object
- Fog::Compute::AzureRM::Mock
- Defined in:
- lib/fog/azurerm/compute.rb,
lib/fog/azurerm/requests/compute/get_image.rb,
lib/fog/azurerm/requests/compute/create_image.rb,
lib/fog/azurerm/requests/compute/delete_image.rb,
lib/fog/azurerm/requests/compute/check_vm_exists.rb,
lib/fog/azurerm/requests/compute/check_vm_status.rb,
lib/fog/azurerm/requests/compute/get_managed_disk.rb,
lib/fog/azurerm/requests/compute/get_vm_extension.rb,
lib/fog/azurerm/requests/compute/delete_managed_disk.rb,
lib/fog/azurerm/requests/compute/delete_vm_extension.rb,
lib/fog/azurerm/requests/compute/get_virtual_machine.rb,
lib/fog/azurerm/requests/compute/get_availability_set.rb,
lib/fog/azurerm/requests/compute/list_virtual_machines.rb,
lib/fog/azurerm/requests/compute/start_virtual_machine.rb,
lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb,
lib/fog/azurerm/requests/compute/create_virtual_machine.rb,
lib/fog/azurerm/requests/compute/delete_virtual_machine.rb,
lib/fog/azurerm/requests/compute/list_availability_sets.rb,
lib/fog/azurerm/requests/compute/create_availability_set.rb,
lib/fog/azurerm/requests/compute/delete_availability_set.rb,
lib/fog/azurerm/requests/compute/restart_virtual_machine.rb,
lib/fog/azurerm/requests/compute/detach_data_disk_from_vm.rb,
lib/fog/azurerm/requests/compute/list_managed_disks_by_rg.rb,
lib/fog/azurerm/requests/compute/redeploy_virtual_machine.rb,
lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb,
lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb,
lib/fog/azurerm/requests/compute/power_off_virtual_machine.rb,
lib/fog/azurerm/requests/compute/deallocate_virtual_machine.rb,
lib/fog/azurerm/requests/compute/generalize_virtual_machine.rb,
lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb,
lib/fog/azurerm/requests/compute/check_availability_set_exists.rb,
lib/fog/azurerm/requests/compute/create_or_update_managed_disk.rb,
lib/fog/azurerm/requests/compute/create_or_update_vm_extension.rb,
lib/fog/azurerm/requests/compute/revoke_access_to_managed_disk.rb,
lib/fog/azurerm/requests/compute/list_managed_disks_in_subscription.rb,
lib/fog/azurerm/requests/compute/list_available_sizes_for_virtual_machine.rb
Overview
This class provides the mock implementation for unit tests.
Instance Method Summary collapse
- #add_or_update_vm_extension ⇒ Object
- #attach_data_disk_to_vm ⇒ Object
- #check_availability_set_exists(_resource_group, _name) ⇒ Object
- #check_managed_disk_exists ⇒ Object
- #check_vm_exists(_resource_group, _name) ⇒ Object
- #check_vm_extension_exists ⇒ Object
- #check_vm_status(_resource_group, _name) ⇒ Object
- #create_availability_set(availability_set_params) ⇒ Object
- #create_image ⇒ Object
- #create_or_update_managed_disk ⇒ Object
- #create_virtual_machine ⇒ Object
- #deallocate_virtual_machine ⇒ Object
- #delete_availability_set(resource_group, name) ⇒ Object
- #delete_image ⇒ Object
- #delete_managed_disk ⇒ Object
- #delete_virtual_machine ⇒ Object
- #delete_vm_extension ⇒ Object
- #detach_data_disk_from_vm ⇒ Object
- #generalize_virtual_machine ⇒ Object
- #get_availability_set ⇒ Object
- #get_image ⇒ Object
- #get_managed_disk ⇒ Object
- #get_virtual_machine ⇒ Object
- #get_vm_extension ⇒ Object
- #grant_access_to_managed_disk ⇒ Object
-
#initialize(_options = {}) ⇒ Mock
constructor
A new instance of Mock.
- #list_availability_sets(resource_group) ⇒ Object
- #list_available_sizes_for_virtual_machine ⇒ Object
- #list_managed_disks_by_rg ⇒ Object
- #list_managed_disks_in_subscription ⇒ Object
- #list_virtual_machines ⇒ Object
- #power_off_virtual_machine ⇒ Object
- #redeploy_virtual_machine ⇒ Object
- #restart_virtual_machine ⇒ Object
- #revoke_access_to_managed_disk ⇒ Object
- #start_virtual_machine ⇒ Object
Constructor Details
#initialize(_options = {}) ⇒ Mock
Returns a new instance of Mock.
66 67 68 69 70 71 72 73 |
# File 'lib/fog/azurerm/compute.rb', line 66 def initialize( = {}) begin require 'azure_mgmt_compute' rescue LoadError => e retry if require('rubygems') raise e. end end |
Instance Method Details
#add_or_update_vm_extension ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fog/azurerm/requests/compute/create_or_update_vm_extension.rb', line 38 def add_or_update_vm_extension(*) body = { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Compute/virtualMachines/TestVM/extensions/IaaSAntimalware', 'name' => 'IaasAntimalware', 'resource_group' => 'fog-test-rg', 'location' => 'West US', 'properties' => { 'publisher' => 'Microsoft.Azure.Security', 'type' => 'IaaSAntimalware', 'typeHandlerVersion' => '1.3', 'autoUpgradeMinorVersion' => 'true', 'forceUpdateTag' => 'RerunExtension', 'settings' => { 'AnitmalwareEnabled' => 'true', 'RealtimeProtectionEnabled' => 'false' }, 'protected_settings' => {} } } extension_mapper = Azure::ARM::Compute::Models::VirtualMachineExtension.mapper @compute_mgmt_client.deserialize(extension_mapper, body, 'result.body') end |
#attach_data_disk_to_vm ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb', line 153 def attach_data_disk_to_vm(*) vm = { 'location' => 'West US', 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server', 'name' => 'fog-test-server', 'type' => 'Microsoft.Compute/virtualMachines', 'properties' => { 'hardwareProfile' => { 'vmSize' => 'Basic_A0' }, 'storageProfile' => { 'imageReference' => { 'publisher' => 'Canonical', 'offer' => 'UbuntuServer', 'sku' => '14.04.2-LTS', 'version' => 'latest' }, 'osDisk' => { 'name' => 'fog-test-server_os_disk', 'vhd' => { 'uri' => 'http://mystorage1.blob.core.windows.net/vhds/fog-test-server_os_disk.vhd' }, 'createOption' => 'FromImage', 'osType' => 'Linux', 'caching' => 'ReadWrite' }, 'dataDisks' => [{ 'lun' => 0, 'name' => 'fog-test-server_data_disk', 'vhd_uri' => 'https://confizrg7443.blob.core.windows.net/vhds/fog-test-server_data_disk.vhd', 'create_option' => 'empty', 'disk_size_gb' => 1 }] }, 'osProfile' => { 'computerName' => 'fog', 'adminUsername' => 'Fog=123', 'linuxConfiguration' => { 'disablePasswordAuthentication' => true }, 'secrets' => [] }, 'networkProfile' => { 'networkInterfaces' => [ { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkInterfaces/fog-test-vnet' } ] }, 'provisioningState' => 'Succeeded' } } vm_mapper = Azure::ARM::Compute::Models::VirtualMachine.mapper @compute_mgmt_client.deserialize(vm_mapper, vm, 'result.body') end |
#check_availability_set_exists(_resource_group, _name) ⇒ Object
25 26 27 |
# File 'lib/fog/azurerm/requests/compute/check_availability_set_exists.rb', line 25 def check_availability_set_exists(_resource_group, _name) true end |
#check_managed_disk_exists ⇒ Object
26 27 28 29 |
# File 'lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb', line 26 def check_managed_disk_exists(*) Fog::Logger.debug 'Managed Disk test-disk from Resource group fog-rg is available.' true end |
#check_vm_exists(_resource_group, _name) ⇒ Object
33 34 35 |
# File 'lib/fog/azurerm/requests/compute/check_vm_exists.rb', line 33 def check_vm_exists(_resource_group, _name) true end |
#check_vm_extension_exists ⇒ Object
25 26 27 |
# File 'lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb', line 25 def check_vm_extension_exists(*) true end |
#check_vm_status(_resource_group, _name) ⇒ Object
32 33 34 |
# File 'lib/fog/azurerm/requests/compute/check_vm_status.rb', line 32 def check_vm_status(_resource_group, _name) 'running' end |
#create_availability_set(availability_set_params) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/fog/azurerm/requests/compute/create_availability_set.rb', line 48 def create_availability_set(availability_set_params) { 'location' => availability_set_params[:location], 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{availability_set_params[:resource_group]}/providers/Microsoft.Compute/availabilitySets/#{availability_set_params[:name]}", 'name' => availability_set_params[:name], 'type' => 'Microsoft.Compute/availabilitySets', 'properties' => { 'platformUpdateDomainCount' => FAULT_DOMAIN_COUNT, 'platformFaultDomainCount' => FAULT_DOMAIN_COUNT } } end |
#create_image ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/fog/azurerm/requests/compute/create_image.rb', line 43 def create_image(*) image_obj = { 'location' => 'West US', 'tags' => { 'key' => 'value' }, 'properties' => { 'storageProfile' => { 'osDisk' => { 'osType' => 'Linux', 'blobUri' => 'https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd', 'osState' => 'generalized', 'hostCaching' => 'readwrite', 'storageAccountType' => 'Standard_LRS' }, 'provisioningState' => 'Succeeded' } } } image_mapper = Azure::ARM::Compute::Models::Image.mapper @compute_mgmt_client.deserialize(image_mapper, image_obj, 'result.body') end |
#create_or_update_managed_disk ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/fog/azurerm/requests/compute/create_or_update_managed_disk.rb', line 78 def create_or_update_managed_disk(*) disk = { 'accountType' => 'Standard_LRS', 'properties' => { 'osType' => 'Windows', 'creationData' => { 'createOption' => 'Empty' }, 'diskSizeGB' => 10, 'encryptionSettings' => { 'enabled' => true, 'diskEncryptionKey' => { 'sourceVault' => { 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault' }, 'secretUrl' => 'https://myvmvault.vault-int.azure-int.net/secrets/{secret}' }, 'keyEncryptionKey' => { 'sourceVault' => { 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault' }, 'keyUrl' => 'https://myvmvault.vault-int.azure-int.net/keys/{key}' } }, 'timeCreated' => '2016-12-28T02:46:21.3322041+00:00', 'provisioningState' => 'Succeeded', 'diskState' => 'Unattached' }, 'type' => 'Microsoft.Compute/disks', 'location' => 'westus', 'tags' => { 'department' => 'Development', 'project' => 'ManagedDisks' }, 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1', 'name' => 'myManagedDisk1' } disk_mapper = Azure::ARM::Compute::Models::Disk.mapper @compute_mgmt_client.deserialize(disk_mapper, disk, 'result.body') end |
#create_virtual_machine ⇒ Object
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/fog/azurerm/requests/compute/create_virtual_machine.rb', line 367 def create_virtual_machine(*) vm = { 'location' => 'westus', 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server', 'name' => 'fog-test-server', 'type' => 'Microsoft.Compute/virtualMachines', 'properties' => { 'hardwareProfile' => { 'vmSize' => 'Standard_A0' }, 'storageProfile' => { 'imageReference' => { 'publisher' => 'MicrosoftWindowsServerEssentials', 'offer' => 'WindowsServerEssentials', 'sku' => 'WindowsServerEssentials', 'version' => 'latest' }, 'osDisk' => { 'name' => 'fog-test-server_os_disk', 'vhd' => { 'uri' => 'http://mystorage1.blob.core.windows.net/vhds/fog-test-server_os_disk.vhd' }, 'createOption' => 'FromImage', 'osType' => 'Linux', 'caching' => 'ReadWrite' }, 'dataDisks' => [] }, 'osProfile' => { 'computerName' => 'fog-test-server', 'adminUsername' => 'fog', 'linuxConfiguration' => { 'disablePasswordAuthentication' => true }, 'secrets' => [], 'customData' => 'ZWNobyBjdXN0b21EYXRh' }, 'networkProfile' => { 'networkInterfaces' => [ { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkInterfaces/fog-test-vnet' } ] }, 'provisioningState' => 'Succeeded' } } vm_mapper = Azure::ARM::Compute::Models::VirtualMachine.mapper @compute_mgmt_client.deserialize(vm_mapper, vm, 'result.body') end |
#deallocate_virtual_machine ⇒ Object
28 29 30 31 |
# File 'lib/fog/azurerm/requests/compute/deallocate_virtual_machine.rb', line 28 def deallocate_virtual_machine(*) Fog::Logger.debug 'Virtual Machine fog-test-server from Resource group fog-test-rg Deallocated successfully.' true end |
#delete_availability_set(resource_group, name) ⇒ Object
20 21 22 23 |
# File 'lib/fog/azurerm/requests/compute/delete_availability_set.rb', line 20 def delete_availability_set(resource_group, name) Fog::Logger.debug "Availability Set #{name} from Resource group #{resource_group} deleted successfully." true end |
#delete_image ⇒ Object
22 23 24 25 |
# File 'lib/fog/azurerm/requests/compute/delete_image.rb', line 22 def delete_image(*) Fog::Logger.debug 'Image fog-test-server-osImage from Resource group fog-test-rg deleted successfully.' true end |
#delete_managed_disk ⇒ Object
30 31 32 33 |
# File 'lib/fog/azurerm/requests/compute/delete_managed_disk.rb', line 30 def delete_managed_disk(*) Fog::Logger.debug 'Managed Disk test-disk from Resource group fog-test-rg deleted successfully.' true end |
#delete_virtual_machine ⇒ Object
28 29 30 31 |
# File 'lib/fog/azurerm/requests/compute/delete_virtual_machine.rb', line 28 def delete_virtual_machine(*) Fog::Logger.debug 'Virtual Machine fog-test-server from Resource group fog-test-rg deleted successfully.' true end |
#delete_vm_extension ⇒ Object
21 22 23 24 |
# File 'lib/fog/azurerm/requests/compute/delete_vm_extension.rb', line 21 def delete_vm_extension(*) Fog::Logger.debug 'Extension extension_name of Virtual Machine vm_name in Resource Group resource_group deleted successfully' true end |
#detach_data_disk_from_vm ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/fog/azurerm/requests/compute/detach_data_disk_from_vm.rb', line 34 def detach_data_disk_from_vm(*) vm = { 'location' => 'West US', 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server', 'name' => 'fog-test-server', 'type' => 'Microsoft.Compute/virtualMachines', 'properties' => { 'hardwareProfile' => { 'vmSize' => 'Basic_A0' }, 'storageProfile' => { 'imageReference' => { 'publisher' => 'Canonical', 'offer' => 'UbuntuServer', 'sku' => '14.04.2-LTS', 'version' => 'latest' }, 'osDisk' => { 'name' => 'fog-test-server_os_disk', 'vhd' => { 'uri' => 'http://mystorage1.blob.core.windows.net/vhds/fog-test-server_os_disk.vhd' }, 'createOption' => 'FromImage', 'osType' => 'Linux', 'caching' => 'ReadWrite' }, 'dataDisks' => [{ 'lun' => 0, 'name' => 'fog-test-server_data_disk', 'vhd_uri' => 'https://confizrg7443.blob.core.windows.net/vhds/fog-test-server_data_disk.vhd', 'create_option' => 'empty', 'disk_size_gb' => 1 }] }, 'osProfile' => { 'computerName' => 'fog', 'adminUsername' => 'Fog=123', 'linuxConfiguration' => { 'disablePasswordAuthentication' => true }, 'secrets' => [] }, 'networkProfile' => { 'networkInterfaces' => [ { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkInterfaces/fog-test-vnet' } ] }, 'provisioningState' => 'Succeeded' } } vm_mapper = Azure::ARM::Compute::Models::VirtualMachine.mapper @compute_mgmt_client.deserialize(vm_mapper, vm, 'result.body') end |
#generalize_virtual_machine ⇒ Object
28 29 30 31 |
# File 'lib/fog/azurerm/requests/compute/generalize_virtual_machine.rb', line 28 def generalize_virtual_machine(*) Fog::Logger.debug 'Virtual Machine fog-test-server from Resource group fog-test-rg Generalized successfully.' true end |
#get_availability_set ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/azurerm/requests/compute/get_availability_set.rb', line 18 def get_availability_set(*) { 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/'resource_group'/providers/Microsoft.Compute/virtualMachines/'name'", 'name' => 'name', 'type' => 'Microsoft.Compute/virtualMachines', 'location' => 'westus', '@platform_update_domain_count' => UPDATE_DOMAIN_COUNT, '@platform_fault_domain_count' => FAULT_DOMAIN_COUNT, '@virtual_machines' => [] } end |
#get_image ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fog/azurerm/requests/compute/get_image.rb', line 21 def get_image(*) body = { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Compute/images/TestImage', 'name' => 'TestImage', 'resource_group' => 'TestRG', 'location' => 'West US', 'storage_profile' => { 'os_disk' => { 'os_type' => 'Linux', 'os_state' => 'Generalized', 'blob_uri' => 'https://myblob.blob.core.windows.net/images/testimage.vhd', 'caching' => 'ReadWrite', 'disk_size_gb' => '5' }, 'data_disks' => [] }, 'provisioning_state' => 'Succeeded' } image_mapper = Azure::ARM::Compute::Models::Image.mapper @compute_mgmt_client.deserialize(image_mapper, body, 'result.body') end |
#get_managed_disk ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/fog/azurerm/requests/compute/get_managed_disk.rb', line 21 def get_managed_disk(*) disk = { 'accountType' => 'Standard_LRS', 'properties' => { 'osType' => 'Windows', 'creationData' => { 'createOption' => 'Empty' }, 'diskSizeGB' => 10, 'encryptionSettings' => { 'enabled' => true, 'diskEncryptionKey' => { 'sourceVault' => { 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault' }, 'secretUrl' => 'https://myvmvault.vault-int.azure-int.net/secrets/{secret}' }, 'keyEncryptionKey' => { 'sourceVault' => { 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault' }, 'keyUrl' => 'https://myvmvault.vault-int.azure-int.net/keys/{key}' } }, 'timeCreated' => '2016-12-28T02:46:21.3322041+00:00', 'provisioningState' => 'Succeeded', 'diskState' => 'Unattached' }, 'type' => 'Microsoft.Compute/disks', 'location' => 'westus', 'tags' => { 'department' => 'Development', 'project' => 'ManagedDisks' }, 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1', 'name' => 'myManagedDisk1' } disk_mapper = Azure::ARM::Compute::Models::Disk.mapper @compute_mgmt_client.deserialize(disk_mapper, disk, 'result.body') end |
#get_virtual_machine ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/fog/azurerm/requests/compute/get_virtual_machine.rb', line 26 def get_virtual_machine(*) vm = { 'location' => 'westus', 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server', 'name' => 'fog-test-server', 'type' => 'Microsoft.Compute/virtualMachines', 'properties' => { 'hardwareProfile' => { 'vmSize' => 'Basic_A0' }, 'storageProfile' => { 'imageReference' => { 'publisher' => 'Canonical', 'offer' => 'UbuntuServer', 'sku' => '14.04.2-LTS', 'version' => 'latest' }, 'osDisk' => { 'name' => 'fog-test-server_os_disk', 'vhd' => { 'uri' => 'http://fogtestsafirst.blob.core.windows.net/vhds/fog-test-server_os_disk.vhd' }, 'createOption' => 'FromImage', 'osType' => 'Linux', 'caching' => 'ReadWrite' }, 'dataDisks' => [] }, 'osProfile' => { 'computerName' => 'fog', 'adminUsername' => 'testfog', 'linuxConfiguration' => { 'disablePasswordAuthentication' => false }, 'secrets' => [] }, 'networkProfile' => { 'networkInterfaces' => [ { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkInterfaces/fog-test-vnet' } ] }, 'provisioningState' => 'Succeeded' } } vm_mapper = Azure::ARM::Compute::Models::VirtualMachine.mapper @compute_mgmt_client.deserialize(vm_mapper, vm, 'result.body') end |
#get_vm_extension ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fog/azurerm/requests/compute/get_vm_extension.rb', line 21 def get_vm_extension(*) body = { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Compute/virtualMachines/TestVM/extensions/IaaSAntimalware', 'name' => 'IaasAntimalware', 'resource_group' => 'fog-test-rg', 'location' => 'West US', 'properties' => { 'publisher' => 'Microsoft.Azure.Security', 'type' => 'IaaSAntimalware', 'typeHandlerVersion' => '1.3', 'autoUpgradeMinorVersion' => 'true', 'forceUpdateTag' => 'RerunExtension', 'settings' => { 'AnitmalwareEnabled' => 'true', 'RealtimeProtectionEnabled' => 'false' }, 'protected_settings' => {} } } extension_mapper = Azure::ARM::Compute::Models::VirtualMachineExtension.mapper @compute_mgmt_client.deserialize(extension_mapper, body, 'result.body') end |
#grant_access_to_managed_disk ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/compute/grant_access_to_managed_disk.rb', line 24 def grant_access_to_managed_disk(*) 'ACCESS URI' end |
#list_availability_sets(resource_group) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fog/azurerm/requests/compute/list_availability_sets.rb', line 20 def list_availability_sets(resource_group) [ { 'id' => "/subscriptions/{subscription-id}/resourceGroups/#{resource_group}/providers/Microsoft.Compute/availabilitySets/test_availability_set", 'name' => 'test_availability_set', 'type' => 'Microsoft.Compute/availabilitySets', 'location' => 'westus', 'tags' => {}, 'properties' => { 'platformUpdateDomainCount' => 5, 'platformFaultDomainCount' => 3, 'virtualMachines' => [] } } ] end |
#list_available_sizes_for_virtual_machine ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/fog/azurerm/requests/compute/list_available_sizes_for_virtual_machine.rb', line 28 def list_available_sizes_for_virtual_machine(*) vm_sizes = { 'value' => [ { 'name' => 'Standard_A0', 'numberOfCores' => 1, 'osDiskSizeInMB' => 1_047_552, 'resourceDiskSizeInMB' => 20_480, 'memoryInMB' => 768, 'maxDataDiskCount' => 1 }, { 'name' => 'Standard_A1', 'numberOfCores' => 1, 'osDiskSizeInMB' => 1_047_552, 'resourceDiskSizeInMB' => 71_680, 'memoryInMB' => 1792, 'maxDataDiskCount' => 2 }, { 'name' => 'Standard_A2', 'numberOfCores' => 2, 'osDiskSizeInMB' => 1_047_552, 'resourceDiskSizeInMB' => 138_240, 'memoryInMB' => 3584, 'maxDataDiskCount' => 4 } ] } vm_mapper = Azure::ARM::Compute::Models::VirtualMachineSizeListResult.mapper @compute_mgmt_client.deserialize(vm_mapper, vm_sizes, 'result.body').value end |
#list_managed_disks_by_rg ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fog/azurerm/requests/compute/list_managed_disks_by_rg.rb', line 21 def list_managed_disks_by_rg(*) disks = [ { 'accountType' => 'Standard_LRS', 'properties' => { 'osType' => 'Windows', 'creationData' => { 'createOption' => 'Empty' }, 'diskSizeGB' => 10, 'encryptionSettings' => { 'enabled' => true, 'diskEncryptionKey' => { 'sourceVault' => { 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault' }, 'secretUrl' => 'https://myvmvault.vault-int.azure-int.net/secrets/{secret}' }, 'keyEncryptionKey' => { 'sourceVault' => { 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault' }, 'keyUrl' => 'https://myvmvault.vault-int.azure-int.net/keys/{key}' } }, 'timeCreated' => '2016-12-28T02:46:21.3322041+00:00', 'provisioningState' => 'Succeeded', 'diskState' => 'Unattached' }, 'type' => 'Microsoft.Compute/disks', 'location' => 'westus', 'tags' => { 'department' => 'Development', 'project' => 'ManagedDisks' }, 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1', 'name' => 'myManagedDisk1' } ] disk_mapper = Azure::ARM::Compute::Models::DiskList.mapper @compute_mgmt_client.deserialize(disk_mapper, disks, 'result.body').value end |
#list_managed_disks_in_subscription ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fog/azurerm/requests/compute/list_managed_disks_in_subscription.rb', line 21 def list_managed_disks_in_subscription disks = [ { 'accountType' => 'Standard_LRS', 'properties' => { 'osType' => 'Windows', 'creationData' => { 'createOption' => 'Empty' }, 'diskSizeGB' => 10, 'encryptionSettings' => { 'enabled' => true, 'diskEncryptionKey' => { 'sourceVault' => { 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault' }, 'secretUrl' => 'https://myvmvault.vault-int.azure-int.net/secrets/{secret}' }, 'keyEncryptionKey' => { 'sourceVault' => { 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault' }, 'keyUrl' => 'https://myvmvault.vault-int.azure-int.net/keys/{key}' } }, 'timeCreated' => '2016-12-28T02:46:21.3322041+00:00', 'provisioningState' => 'Succeeded', 'diskState' => 'Unattached' }, 'type' => 'Microsoft.Compute/disks', 'location' => 'westus', 'tags' => { 'department' => 'Development', 'project' => 'ManagedDisks' }, 'id' => '/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1', 'name' => 'myManagedDisk1' } ] disk_mapper = Azure::ARM::Compute::Models::DiskList.mapper @compute_mgmt_client.deserialize(disk_mapper, disks, 'result.body').value end |
#list_virtual_machines ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fog/azurerm/requests/compute/list_virtual_machines.rb', line 20 def list_virtual_machines(*) vms = { 'value' => [ { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server', 'name' => 'fog-test-server', 'location' => 'West US', 'properties' => { 'hardwareProfile' => { 'vmSize' => 'Basic_A0' }, 'storageProfile' => { 'imageReference' => { 'publisher' => 'Canonical', 'offer' => 'UbuntuServer', 'sku' => '14.04.2-LTS', 'version' => 'latest' }, 'osDisk' => { 'name' => 'fog-test-server_os_disk', 'vhd' => { 'uri' => 'http://storageAccount.blob.core.windows.net/vhds/fog-test-server_os_disk.vhd' } } }, 'osProfile' => { 'computerName' => 'fog-test-server', 'adminUsername' => 'shaffan', 'linuxConfiguration' => { 'disablePasswordAuthentication' => false } }, 'networkProfile' => { 'networkInterfaces' => [ { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkInterfaces/fog-test-vnet' } ] } } } ] } vm_mapper = Azure::ARM::Compute::Models::VirtualMachineListResult.mapper @compute_mgmt_client.deserialize(vm_mapper, vms, 'result.body').value end |
#power_off_virtual_machine ⇒ Object
28 29 30 31 |
# File 'lib/fog/azurerm/requests/compute/power_off_virtual_machine.rb', line 28 def power_off_virtual_machine(*) Fog::Logger.debug 'Virtual Machine fog-test-server from Resource group fog-test-rg Powered off successfully.' true end |
#redeploy_virtual_machine ⇒ Object
28 29 30 31 |
# File 'lib/fog/azurerm/requests/compute/redeploy_virtual_machine.rb', line 28 def redeploy_virtual_machine(*) Fog::Logger.debug 'Virtual Machine fog-test-server from Resource group fog-test-rg Redeployed successfully.' true end |
#restart_virtual_machine ⇒ Object
28 29 30 31 |
# File 'lib/fog/azurerm/requests/compute/restart_virtual_machine.rb', line 28 def restart_virtual_machine(*) Fog::Logger.debug 'Virtual Machine fog-test-server from Resource group fog-test-rg Restarted successfully.' true end |
#revoke_access_to_managed_disk ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/azurerm/requests/compute/revoke_access_to_managed_disk.rb', line 21 def revoke_access_to_managed_disk(*) response = { 'name' => 'revoke', 'status' => 200, 'error' => 'Error Details' } response_mapper = Azure::ARM::Compute::Models::OperationStatusResponse.mapper @compute_mgmt_client.deserialize(response_mapper, response, 'result.body') end |
#start_virtual_machine ⇒ Object
28 29 30 31 |
# File 'lib/fog/azurerm/requests/compute/start_virtual_machine.rb', line 28 def start_virtual_machine(*) Fog::Logger.debug 'Virtual Machine fog-test-server from Resource group fog-test-rg started successfully.' true end |