fog-azure-rm-temp 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/.arclint +8 -0
  3. data/.travis.yml +28 -14
  4. data/CHANGELOG.md +77 -0
  5. data/CONTRIBUTORS.md +4 -0
  6. data/fog-azure-rm.gemspec +3 -2
  7. data/lib/fog/azurerm.rb +1 -0
  8. data/lib/fog/azurerm/async_response.rb +9 -1
  9. data/lib/fog/azurerm/compute.rb +3 -1
  10. data/lib/fog/azurerm/constants.rb +11 -3
  11. data/lib/fog/azurerm/dns.rb +3 -1
  12. data/lib/fog/azurerm/docs/application_gateway.md +119 -117
  13. data/lib/fog/azurerm/docs/compute.md +299 -202
  14. data/lib/fog/azurerm/docs/dns.md +44 -43
  15. data/lib/fog/azurerm/docs/key_vault.md +31 -28
  16. data/lib/fog/azurerm/docs/network.md +407 -404
  17. data/lib/fog/azurerm/docs/resources.md +52 -49
  18. data/lib/fog/azurerm/docs/sql.md +56 -54
  19. data/lib/fog/azurerm/docs/storage.md +92 -157
  20. data/lib/fog/azurerm/docs/traffic_manager.md +55 -53
  21. data/lib/fog/azurerm/models/application_gateway/gateway.rb +5 -1
  22. data/lib/fog/azurerm/models/compute/availability_set.rb +4 -1
  23. data/lib/fog/azurerm/models/compute/managed_disk.rb +0 -1
  24. data/lib/fog/azurerm/models/compute/server.rb +61 -11
  25. data/lib/fog/azurerm/models/compute/servers.rb +2 -2
  26. data/lib/fog/azurerm/models/dns/a_record.rb +15 -0
  27. data/lib/fog/azurerm/models/dns/cname_record.rb +15 -0
  28. data/lib/fog/azurerm/models/dns/record_set.rb +20 -8
  29. data/lib/fog/azurerm/models/key_vault/vault.rb +3 -1
  30. data/lib/fog/azurerm/models/network/load_balancer.rb +3 -1
  31. data/lib/fog/azurerm/models/network/local_network_gateway.rb +3 -1
  32. data/lib/fog/azurerm/models/network/network_interface.rb +3 -1
  33. data/lib/fog/azurerm/models/network/network_security_group.rb +4 -2
  34. data/lib/fog/azurerm/models/network/public_ip.rb +4 -2
  35. data/lib/fog/azurerm/models/network/virtual_network.rb +4 -2
  36. data/lib/fog/azurerm/models/resources/resource_group.rb +3 -1
  37. data/lib/fog/azurerm/models/sql/sql_database.rb +3 -3
  38. data/lib/fog/azurerm/models/sql/sql_server.rb +3 -2
  39. data/lib/fog/azurerm/models/storage/directories.rb +6 -1
  40. data/lib/fog/azurerm/models/storage/file.rb +2 -0
  41. data/lib/fog/azurerm/models/storage/storage_account.rb +4 -1
  42. data/lib/fog/azurerm/models/storage/storage_accounts.rb +7 -0
  43. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +3 -1
  44. data/lib/fog/azurerm/requests/application_gateway/check_ag_exists.rb +1 -1
  45. data/lib/fog/azurerm/requests/application_gateway/create_or_update_application_gateway.rb +1 -0
  46. data/lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb +2 -2
  47. data/lib/fog/azurerm/requests/compute/check_availability_set_exists.rb +1 -1
  48. data/lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb +1 -1
  49. data/lib/fog/azurerm/requests/compute/check_vm_exists.rb +1 -1
  50. data/lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb +2 -2
  51. data/lib/fog/azurerm/requests/compute/create_availability_set.rb +4 -2
  52. data/lib/fog/azurerm/requests/compute/create_image.rb +68 -0
  53. data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +302 -135
  54. data/lib/fog/azurerm/requests/compute/delete_image.rb +29 -0
  55. data/lib/fog/azurerm/requests/compute/get_image.rb +45 -0
  56. data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +4 -2
  57. data/lib/fog/azurerm/requests/dns/check_record_set_exists.rb +1 -1
  58. data/lib/fog/azurerm/requests/dns/check_zone_exists.rb +3 -2
  59. data/lib/fog/azurerm/requests/dns/create_or_update_record_set.rb +3 -2
  60. data/lib/fog/azurerm/requests/dns/create_or_update_zone.rb +1 -2
  61. data/lib/fog/azurerm/requests/key_vault/check_vault_exists.rb +1 -1
  62. data/lib/fog/azurerm/requests/key_vault/create_or_update_vault.rb +1 -0
  63. data/lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb +1 -1
  64. data/lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb +1 -1
  65. data/lib/fog/azurerm/requests/network/check_load_balancer_exists.rb +1 -1
  66. data/lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb +1 -1
  67. data/lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb +1 -1
  68. data/lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb +1 -1
  69. data/lib/fog/azurerm/requests/network/check_network_interface_exists.rb +1 -1
  70. data/lib/fog/azurerm/requests/network/check_public_ip_exists.rb +1 -1
  71. data/lib/fog/azurerm/requests/network/check_subnet_exists.rb +1 -1
  72. data/lib/fog/azurerm/requests/network/check_virtual_network_exists.rb +1 -1
  73. data/lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb +1 -1
  74. data/lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb +1 -1
  75. data/lib/fog/azurerm/requests/network/create_load_balancer.rb +4 -4
  76. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
  77. data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +1 -2
  78. data/lib/fog/azurerm/requests/network/create_or_update_network_interface.rb +4 -3
  79. data/lib/fog/azurerm/requests/network/create_or_update_network_security_group.rb +4 -3
  80. data/lib/fog/azurerm/requests/network/create_or_update_public_ip.rb +5 -3
  81. data/lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb +4 -3
  82. data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +1 -1
  83. data/lib/fog/azurerm/requests/resources/check_azure_resource_exists.rb +4 -4
  84. data/lib/fog/azurerm/requests/resources/create_resource_group.rb +2 -1
  85. data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +4 -4
  86. data/lib/fog/azurerm/requests/resources/tag_resource.rb +4 -4
  87. data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +13 -10
  88. data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +8 -5
  89. data/lib/fog/azurerm/requests/storage/check_storage_account_exists.rb +1 -1
  90. data/lib/fog/azurerm/requests/storage/create_storage_account.rb +4 -2
  91. data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb +1 -1
  92. data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb +1 -1
  93. data/lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_profile.rb +13 -3
  94. data/lib/fog/azurerm/storage.rb +0 -18
  95. data/lib/fog/azurerm/utilities/general.rb +21 -10
  96. data/lib/fog/azurerm/version.rb +1 -1
  97. data/rake-script.sh +7 -1
  98. data/rakefile +1 -1
  99. data/test/api_stub.rb +19 -2
  100. data/test/api_stub/models/compute/server.rb +21 -5
  101. data/test/api_stub/requests/compute/image.rb +41 -0
  102. data/test/api_stub/requests/compute/virtual_machine.rb +60 -62
  103. data/test/api_stub/requests/resources/resource_group.rb +1 -1
  104. data/test/integration/application_gateway.rb +8 -1
  105. data/test/integration/availability_set.rb +9 -2
  106. data/test/integration/external_load_balancer.rb +2 -1
  107. data/test/integration/internal_load_balancer.rb +2 -1
  108. data/test/integration/key_vault.rb +2 -1
  109. data/test/integration/managed_disk.rb +10 -5
  110. data/test/integration/network_interface.rb +2 -1
  111. data/test/integration/network_security_group.rb +2 -1
  112. data/test/integration/public_ip.rb +2 -1
  113. data/test/integration/record_set.rb +5 -5
  114. data/test/integration/resource_group.rb +5 -2
  115. data/test/integration/resource_tag.rb +4 -2
  116. data/test/integration/server.rb +113 -23
  117. data/test/integration/server_custom_image.rb +120 -20
  118. data/test/integration/sql_server.rb +10 -2
  119. data/test/integration/storage_account.rb +32 -20
  120. data/test/integration/traffic_manager.rb +6 -1
  121. data/test/integration/virtual_network.rb +2 -1
  122. data/test/integration/virtual_network_gateway_connection.rb +3 -3
  123. data/test/models/application_gateway/test_gateway.rb +2 -1
  124. data/test/models/compute/test_availability_set.rb +2 -1
  125. data/test/models/compute/test_managed_disk.rb +2 -1
  126. data/test/models/compute/test_server.rb +13 -4
  127. data/test/models/dns/test_zone.rb +2 -1
  128. data/test/models/key_vault/test_vault.rb +2 -1
  129. data/test/models/network/test_load_balancer.rb +2 -1
  130. data/test/models/network/test_network_interface.rb +2 -1
  131. data/test/models/network/test_network_security_group.rb +2 -1
  132. data/test/models/network/test_public_ip.rb +2 -1
  133. data/test/models/network/test_virtual_network.rb +2 -1
  134. data/test/models/resources/test_resource_group.rb +2 -1
  135. data/test/models/sql/test_database.rb +2 -1
  136. data/test/models/sql/test_sql_server.rb +2 -1
  137. data/test/models/storage/test_storage_account.rb +2 -1
  138. data/test/models/traffic_manager/test_traffic_manager_profile.rb +2 -1
  139. data/test/requests/application_gateway/test_check_ag_exists.rb +11 -4
  140. data/test/requests/compute/test_attach_data_disk_to_vm.rb +2 -2
  141. data/test/requests/compute/test_check_availability_set_exists.rb +9 -2
  142. data/test/requests/compute/test_check_managed_disk_exists.rb +9 -2
  143. data/test/requests/compute/test_check_vm_exists.rb +9 -2
  144. data/test/requests/compute/test_check_vm_extension_exists.rb +9 -2
  145. data/test/requests/compute/test_create_image.rb +27 -0
  146. data/test/requests/compute/test_create_virtual_machine.rb +41 -17
  147. data/test/requests/compute/test_delete_image.rb +23 -0
  148. data/test/requests/compute/test_get_image.rb +23 -0
  149. data/test/requests/dns/test_check_record_set_exists.rb +9 -2
  150. data/test/requests/dns/test_check_zone_exists.rb +16 -2
  151. data/test/requests/key_vault/test_check_vault_exists.rb +9 -2
  152. data/test/requests/network/test_check_express_route_cir_auth_exists.rb +9 -2
  153. data/test/requests/network/test_check_express_route_circuit_exists.rb +9 -2
  154. data/test/requests/network/test_check_load_balancer_exists.rb +9 -2
  155. data/test/requests/network/test_check_local_net_gateway_exists.rb +11 -4
  156. data/test/requests/network/test_check_net_sec_group_exists.rb +9 -2
  157. data/test/requests/network/test_check_net_sec_rule_exists.rb +9 -2
  158. data/test/requests/network/test_check_network_interface_exists.rb +9 -2
  159. data/test/requests/network/test_check_public_ip_exists.rb +9 -2
  160. data/test/requests/network/test_check_subnet_exists.rb +9 -2
  161. data/test/requests/network/test_check_virtual_network_exists.rb +10 -4
  162. data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +9 -2
  163. data/test/requests/network/test_check_vnet_gateway_exists.rb +9 -2
  164. data/test/requests/network/test_create_load_balancer.rb +3 -2
  165. data/test/requests/network/test_create_network_interface.rb +4 -3
  166. data/test/requests/network/test_create_or_update_network_security_group.rb +3 -2
  167. data/test/requests/network/test_create_or_update_virtual_network.rb +5 -3
  168. data/test/requests/network/test_create_public_ip.rb +3 -2
  169. data/test/requests/network/test_update_public_ip.rb +3 -2
  170. data/test/requests/resources/test_create_resource_group.rb +3 -2
  171. data/test/requests/resources/test_delete_resource_tag.rb +3 -3
  172. data/test/requests/resources/test_tag_resource.rb +3 -3
  173. data/test/requests/storage/test_check_storage_account_exists.rb +8 -1
  174. data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +9 -2
  175. data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +9 -2
  176. data/test/test_helper.rb +5 -14
  177. metadata +67 -75
  178. data/lib/fog/azurerm/models/storage/recovery_vault.rb +0 -50
  179. data/lib/fog/azurerm/models/storage/recovery_vaults.rb +0 -27
  180. data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +0 -54
  181. data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +0 -35
  182. data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +0 -60
  183. data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +0 -61
  184. data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +0 -56
  185. data/lib/fog/azurerm/requests/storage/get_backup_container.rb +0 -53
  186. data/lib/fog/azurerm/requests/storage/get_backup_item.rb +0 -58
  187. data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +0 -53
  188. data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +0 -64
  189. data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +0 -49
  190. data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +0 -48
  191. data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +0 -36
  192. data/lib/fog/azurerm/requests/storage/start_backup.rb +0 -54
  193. data/test/api_stub/models/storage/recovery_vault.rb +0 -23
  194. data/test/api_stub/requests/storage/recovery_vault.rb +0 -189
  195. data/test/models/storage/test_recovery_vault.rb +0 -61
  196. data/test/models/storage/test_recovery_vaults.rb +0 -47
  197. data/test/requests/storage/test_create_recovery_vault.rb +0 -35
  198. data/test/requests/storage/test_delete_recovery_vault.rb +0 -34
  199. data/test/requests/storage/test_disable_backup_protection.rb +0 -52
  200. data/test/requests/storage/test_enable_backup_protection.rb +0 -66
  201. data/test/requests/storage/test_get_all_backup_jobs.rb +0 -35
  202. data/test/requests/storage/test_get_backup_container.rb +0 -35
  203. data/test/requests/storage/test_get_backup_item.rb +0 -35
  204. data/test/requests/storage/test_get_backup_job_for_vm.rb +0 -26
  205. data/test/requests/storage/test_get_backup_protection_policy.rb +0 -35
  206. data/test/requests/storage/test_get_recovery_vault.rb +0 -35
  207. data/test/requests/storage/test_list_recovery_vault.rb +0 -35
  208. data/test/requests/storage/test_set_recovery_vault_context.rb +0 -34
  209. data/test/requests/storage/test_start_backup.rb +0 -55
@@ -1,6 +1,6 @@
1
1
  # Compute
2
2
 
3
- This document explains how to get started using Azure Compute Service with Fog. With this gem you can create/update/list/delete availability sets and virtual machines.
3
+ This document explains how to get started using Azure Compute Service with Fog. With this gem you can create, update, list or delete availability sets and virtual machines.
4
4
 
5
5
  ## Usage
6
6
 
@@ -15,79 +15,119 @@ require 'fog/azurerm'
15
15
  Next, create a connection to the Compute Service:
16
16
 
17
17
  ```ruby
18
- azure_compute_service = Fog::Compute.new(
19
- provider: 'AzureRM',
20
- tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
21
- client_id: '<Clientid>', # Client id of Azure Active Directory Application
22
- client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
23
- subscription_id: '<Subscriptionid>', # Subscription id of an Azure Account
24
- :environment => '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
18
+ fog_compute_service = Fog::Compute::AzureRM.new(
19
+ tenant_id: '<Tenant Id>', # Tenant Id of Azure Active Directory Application
20
+ client_id: '<Client Id>', # Client Id of Azure Active Directory Application
21
+ client_secret: '<Client Secret>', # Client Secret of Azure Active Directory Application
22
+ subscription_id: '<Subscription Id>', # Subscription Id of an Azure Account
23
+ environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
25
24
  )
26
25
  ```
27
26
 
28
27
  ## Check Server Existence
29
28
 
30
29
  ```ruby
31
- azure_compute_service.servers.check_vm_exists(<Resource Group name>, <VM Name>)
30
+ fog_compute_service.servers.check_vm_exists('<Resource Group Name>', '<VM Name>')
32
31
  ```
33
32
 
34
33
  ## Create Server
35
34
 
36
- Create a new linux server
37
-
38
35
  **Info:**
39
- Attribute **network_interface_card_ids** is an array of NICs ids. The NIC id at index zero will become primary NIC of this server(virtual machine) by default.
36
+
37
+ - Attribute **network_interface_card_ids** is an array of NICs Ids. The NIC Id at index zero will become primary NIC of this server (virtual machine) by default.
38
+ - To create VM with managed OS disk, use the _managed_disk_storage_type_ argument
39
+ - To create VM with unmanaged OS disk, use the _storage_account_name_ argument
40
+
41
+ ### Virtual Machine (Managed OS Disk)
42
+
43
+ ```ruby
44
+ fog_compute_service.servers.create(
45
+ name: '<VM Name>',
46
+ location: '<Location>',
47
+ resource_group: '<Resource Group Name>',
48
+ tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' },
49
+ vm_size: '<Virtual Machine Size>',
50
+ username: '<Username>',
51
+ disable_password_authentication: <True/False>,
52
+ network_interface_card_ids: ['/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/networkInterfaces/<Network Interface Id>'],
53
+ publisher: '<Publisher Name>', # Not required if custom image is being used
54
+ offer: '<Offer Name>', # Not required if custom image is being used
55
+ sku: '<SKU Name>', # Not required if custom image is being used
56
+ version: '<Version>', # Not required if custom image is being used
57
+ platform: '<OS Type>',
58
+ availability_set_id: '<Availability Set Id>', # [Optional]
59
+ password: '<Password>', # [Optional], if 'platform' partameter is 'Linux'.
60
+ vhd_path: '<Path of VHD>', # [Optional], if you want to create the VM from a custom image.
61
+ custom_data: '<Custom Data Value>', # [Optional], if you want to add custom data in this VM.
62
+ os_disk_caching: '<Caching Type>', # [Optional], can be one of None, ReadOnly, ReadWrite
63
+ managed_disk_storage_type: '<Storage Account Type>', # [Optional], if storage_account_name is passed, can be StandardLRS or PremiumLRS
64
+ os_disk_size: <Disk Size>, # [Optional], size of the os disk in GB (upto 1023)
65
+ os_disk_name: '<Disk Name>' # [Optional], name of the os disk
66
+ )
67
+ ```
40
68
 
41
69
  **Info:**
42
- When using **managed_disk_storage_type** you should not pass the **vhd_path** as the managed disk will be used for the OS disk. Also, data disks cannot be attached to a VM which uses managed disks for the OS disk.
70
+
71
+ - To create VM from Image, pass in the Image ID in `image_ref` attribute
72
+
73
+ **Limitation:**
74
+
75
+ - Image should be in the same region
76
+ - ONLY managed VM can be created from image
77
+
78
+ ### Virtual Machine (Managed OS Disk from Image)
43
79
 
44
80
  ```ruby
45
- azure_compute_service.servers.create(
81
+ fog_compute_service.servers.create(
46
82
  name: '<VM Name>',
47
- location: 'West US',
83
+ location: '<Location>',
48
84
  resource_group: '<Resource Group Name>',
49
- vm_size: 'Basic_A0',
50
- storage_account_name: '<Storage Account Name>',
51
- username: '<Username for VM>',
52
- password: '<Password for VM>', # Optional, if 'platform' partameter is 'Linux'.
53
- disable_password_authentication: false,
54
- network_interface_card_ids: ['/subscriptions/{Subscription-Id}/resourceGroups/{Resource-Group-Name}/providers/Microsoft.Network/networkInterfaces/{Network-Interface-Id}'],
55
- availability_set_id: '<availability_set_id>', # Optional
56
- publisher: 'Canonical', # Not required if custom image is being used
57
- offer: 'UbuntuServer', # Not required if custom image is being used
58
- sku: '14.04.2-LTS', # Not required if custom image is being used
59
- version: 'latest', # Not required if custom image is being used
60
- platform: 'Linux',
61
- vhd_path: '<Path of VHD>', # Optional, if you want to create the VM from a custom image.
62
- custom_data: 'echo customData', # Optional, if you want to add custom data in this VM.
63
- os_disk_caching: Fog::ARM::Compute::Models::CachingTypes::None, # Optional, can be one of None, ReadOnly, ReadWrite
64
- managed_disk_storage_type: Azure::ARM::Compute::Models::StorageAccountTypes::StandardLRS # Optional, can be StandardLRS or PremiumLRS
65
- )
66
- ```
67
-
68
- Create a new windows server
69
-
70
- ```ruby
71
- azure_compute_service.servers.create(
85
+ tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' },
86
+ vm_size: '<Virtual Machine Size>',
87
+ username: '<Username>',
88
+ disable_password_authentication: <True/False>,
89
+ network_interface_card_ids: ['/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/networkInterfaces/<Network Interface Id>'],
90
+ publisher: '<Publisher Name>', # Not required if custom image is being used
91
+ offer: '<Offer Name>', # Not required if custom image is being used
92
+ sku: '<SKU Name>', # Not required if custom image is being used
93
+ version: '<Version>', # Not required if custom image is being used
94
+ platform: '<OS Type>',
95
+ availability_set_id: '<Availability Set Id>', # [Optional]
96
+ password: '<Password>', # [Optional], if 'platform' partameter is 'Linux'.
97
+ image_ref: '<Image ID>', # [Optional], if you want to create the VM from a custom image.
98
+ custom_data: '<Custom Data Value>', # [Optional], if you want to add custom data in this VM.
99
+ os_disk_caching: '<Caching Type>', # [Optional], can be one of None, ReadOnly, ReadWrite
100
+ managed_disk_storage_type: '<Storage Account Type>', # [Optional], if storage_account_name is passed, can be StandardLRS or PremiumLRS
101
+ os_disk_size: <Disk Size>, # [Optional], size of the os disk in GB (upto 1023)
102
+ os_disk_name: '<Disk Name>' # [Optional], name of the os disk
103
+ )
104
+ ```
105
+
106
+ ### Virtual Machine (Unmanaged OS Disk)
107
+
108
+ ```ruby
109
+ fog_compute_service.servers.create(
72
110
  name: '<VM Name>',
73
- location: 'West US',
111
+ location: '<Location>',
74
112
  resource_group: '<Resource Group Name>',
75
- vm_size: 'Basic_A0',
113
+ tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' },
114
+ vm_size: '<Virtual Machine Size>',
76
115
  storage_account_name: '<Storage Account Name>',
77
- username: '<Username for VM>',
78
- password: '<Password for VM>',
79
- disable_password_authentication: false,
80
- network_interface_card_ids: ['/subscriptions/{Subscription-Id}/resourceGroups/{Resource-Group-Name}/providers/Microsoft.Network/networkInterfaces/{Network-Interface-Id}'],
81
- availability_set_id: '<availability_set_id>', # Optional
82
- publisher: 'MicrosoftWindowsServerEssentials', # Not required if custom image is being used
83
- offer: 'WindowsServerEssentials', # Not required if custom image is being used
84
- sku: 'WindowsServerEssentials', # Not required if custom image is being used
85
- version: 'latest', # Not required if custom image is being used
86
- platform: 'Windows',
87
- vhd_path: '<Path of VHD>', # Optional, if you want to create the VM from a custom image.
88
- custom_data: 'echo customData', # Optional, if you want to add custom data in this VM.
89
- managed_disk_storage_type: Azure::ARM::Compute::Models::StorageAccountTypes::StandardLRS # Optional, can be StandardLRS or PremiumLRS
90
- )
116
+ username: '<Username>',
117
+ password: '<Password>',
118
+ disable_password_authentication: <True/False>,
119
+ network_interface_card_ids: ['/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/networkInterfaces/<Network Interface Id>'],
120
+ publisher: '<Publisher Name>', # Not required if custom image is being used
121
+ offer: '<Offer Name>', # Not required if custom image is being used
122
+ sku: '<SKU Name>', # Not required if custom image is being used
123
+ version: '<Version>', # Not required if custom image is being used
124
+ platform: '<OS Type>',
125
+ availability_set_id: '<Availability Set Id>', # [Optional]
126
+ vhd_path: '<Path of VHD>', # [Optional], if you want to create the VM from a custom image.
127
+ custom_data: '<Custom Data Value>', # [Optional], if you want to add custom data in this VM.
128
+ os_disk_size: <Disk Size>, # [Optional], size of the os disk in GB (upto 1023)
129
+ os_disk_name: '<Disk Name>' # [Optional], name of the os disk
130
+ )
91
131
  ```
92
132
 
93
133
  ## Create Server Asynchronously
@@ -95,27 +135,30 @@ Create a new windows server
95
135
  Create a new linux server asynchronously
96
136
 
97
137
  ```ruby
98
- async_response = azure_compute_service.servers.create_async(
138
+ async_response = fog_compute_service.servers.create_async(
99
139
  name: '<VM Name>',
100
- location: 'West US',
140
+ location: '<Location>',
101
141
  resource_group: '<Resource Group Name>',
102
- vm_size: 'Basic_A0',
142
+ tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' },
143
+ vm_size: '<Virtual Machine Size>',
103
144
  storage_account_name: '<Storage Account Name>',
104
145
  username: '<Username for VM>',
105
- password: '<Password for VM>', # Optional, if 'platform' partameter is 'Linux'.
106
- disable_password_authentication: false,
107
- network_interface_card_ids: ['/subscriptions/{Subscription-Id}/resourceGroups/{Resource-Group-Name}/providers/Microsoft.Network/networkInterfaces/{Network-Interface-Id}'],
108
- availability_set_id: '<availability_set_id>', # Optional
109
- publisher: 'Canonical', # Not required if custom image is being used
110
- offer: 'UbuntuServer', # Not required if custom image is being used
111
- sku: '14.04.2-LTS', # Not required if custom image is being used
112
- version: 'latest', # Not required if custom image is being used
113
- platform: 'Linux',
114
- vhd_path: '<Path of VHD>', # Optional, if you want to create the VM from a custom image.
115
- custom_data: 'echo customData', # Optional, if you want to add custom data in this VM.
116
- os_disk_caching: Fog::ARM::Compute::Models::CachingTypes::None, # Optional, can be one of None, ReadOnly, ReadWrite
117
- managed_disk_storage_type: Azure::ARM::Compute::Models::StorageAccountTypes::StandardLRS # Optional, can be StandardLRS or PremiumLRS
118
- )
146
+ disable_password_authentication: <True/False>,
147
+ network_interface_card_ids: ['/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/networkInterfaces/<Network Interface Id>'],
148
+ publisher: '<Publisher Name>', # Not required if custom image is being used
149
+ offer: '<Offer Name>', # Not required if custom image is being used
150
+ sku: '<SKU Name>', # Not required if custom image is being used
151
+ version: '<Version>' , # Not required if custom image is being used
152
+ platform: '<OS Type>',
153
+ availability_set_id: '<Availability Set Id>', # [Optional]
154
+ password: '<Password>', # [Optional], if 'platform' partameter is 'Linux'.
155
+ vhd_path: '<Path of VHD>', # [Optional], if you want to create the VM from a custom image.
156
+ custom_data: '<Custom Data Value>', # [Optional], if you want to add custom data in this VM.
157
+ os_disk_caching: '<Caching Type>', # [Optional], can be one of None, ReadOnly, ReadWrite
158
+ managed_disk_storage_type: '<Storage Account Type>', # [Optional], can be StandardLRS or PremiumLRS
159
+ os_disk_size: <Disk Size>, # [Optional], size of the os disk in GB (upto 1023)
160
+ os_disk_name: '<Disk Name>' # [Optional], name of the os disk
161
+ )
119
162
  ```
120
163
  Following methods are available to handle async respoonse:
121
164
  - state
@@ -147,18 +190,18 @@ while 1
147
190
  end
148
191
  ```
149
192
 
150
- For more information about custom_data; see link: https://msdn.microsoft.com/en-us/library/azure/mt163591.aspx
193
+ For more information about custom_data, see link: https://msdn.microsoft.com/en-us/library/azure/mt163591.aspx
151
194
 
152
195
  ## List Servers
153
196
 
154
197
  List servers in a resource group
155
198
 
156
199
  ```ruby
157
- servers = azure_compute_service.servers(resource_group: '<Resource Group name>')
158
- servers.each do |server|
200
+ servers = fog_compute_service.servers(resource_group: '<Resource Group Name>')
201
+ servers.each do |server|
159
202
  puts "#{server.name}"
160
203
  puts "#{server.location}"
161
- end
204
+ end
162
205
  ```
163
206
 
164
207
  ## Retrieve a single Server
@@ -166,241 +209,295 @@ List servers in a resource group
166
209
  Get a single record of Server
167
210
 
168
211
  ```ruby
169
- server = azure_compute_service
170
- .servers(resource_group: '<Resource Group name>')
171
- .get('<Resource Group name>', 'Server name>')
172
- puts "#{server.name}"
212
+ server = fog_compute_service
213
+ .servers(resource_group: '<Resource Group Name>')
214
+ .get('<Resource Group Name>', 'Server Name>')
215
+ puts "#{server.name}"
173
216
  ```
174
217
 
175
- ## Attach a Data Disk to Server
218
+ ## Get a Server's status
176
219
 
177
- Get the server object and attach a Data Disk to it.
220
+ Check the status of a Server
178
221
 
222
+ ```ruby
223
+ status = fog_compute_service
224
+ .servers
225
+ .get('<Resource Group Name>', '<Server Name>')
226
+ .vm_status
227
+ puts status
228
+ ```
229
+
230
+ ## Start a Server
179
231
  ```ruby
180
- server.attach_data_disk('<Disk Name>', <Size in GB>, '<Storage Account Name>')
232
+ server.start
181
233
  ```
182
234
 
183
- ## Detach a Data Disk from Server
235
+ ## Power Off a Server
236
+ ```ruby
237
+ server.power_off
238
+ ```
184
239
 
185
- Get the server object and detach a Data Disk from it.
240
+ ## Restart a Server
241
+ ```ruby
242
+ server.restart
243
+ ```
186
244
 
245
+ ## Deallocate a Server
187
246
  ```ruby
188
- server.detach_data_disk('<Disk Name>')
247
+ server.deallocate
189
248
  ```
190
249
 
191
- ## Get a Server's status
250
+ ## Redeploy a Server
251
+ ```ruby
252
+ server.redeploy
253
+ ```
192
254
 
193
- Check the status of a Server
255
+ ## Destroy a single Server
194
256
 
195
- ```ruby
196
- status = azure_compute_service
197
- .servers
198
- .get('<Resource Group name>', '<Server name>')
199
- .vm_status
200
- puts status
257
+ Get a server object from the get method (described above) and then destroy that server.
258
+
259
+ ```ruby
260
+ server.destroy
201
261
  ```
202
262
 
203
- ## Destroy a single Server
263
+ ## Attach a Data Disk to Server
204
264
 
205
- Get a server object from the get method(described above) and then destroy that server.
265
+ Get the server object and attach a Data Disk to it. The data disk attached is blob based.
206
266
 
207
267
  ```ruby
208
- server.destroy
268
+ server.attach_data_disk('<Disk Name>', <Size in GBs>, '<Storage Account Name>')
209
269
  ```
210
270
 
211
- ## Check Availability Set Existence
271
+ ## Detach a Data Disk from Server
272
+
273
+ Get the server object and detach a Data Disk from it.
212
274
 
213
275
  ```ruby
214
- azure_compute_service.availability_sets.check_availability_set_exists(<Resource Group name>, <Availability Set name>)
276
+ server.detach_data_disk('<Disk Name>')
215
277
  ```
216
278
 
217
- ## Create Availability Set
279
+ ## Create Managed Disk
218
280
 
219
- Create a new availability set
281
+ Create a new Premium Managed Disk
220
282
 
221
283
  ```ruby
222
- azure_compute_service.availability_sets.create(
223
- name: '<Availability Set name>',
224
- location: '<Location>',
225
- resource_group: '<Resource Group name>'
226
- platform_fault_domain_count: <No of Fault Domains>, # [Optional] Default => 2
227
- platform_update_domain_count: <No of Update Domains>, # [Optional] Default => 5
228
- use_managed_disk: true # [Optional] Possible values true or false
284
+ fog_compute_service.managed_disks.create(
285
+ name: '<Disk Name>',
286
+ location: '<Location>',
287
+ resource_group_name: '<Resource Group Name>',
288
+ account_type: '<Storage Account Type>',
289
+ disk_size_gb: <Disk Size in GBs>,
290
+ creation_data: {
291
+ create_option: '<Create Option Value>'
292
+ }
229
293
  )
230
294
  ```
231
- ## List Availability Sets
232
295
 
233
- List availability sets in a resource group
296
+ Create a new Standard Managed Disk
234
297
 
235
298
  ```ruby
236
- availability_sets = azure_compute_service.availability_sets(resource_group: '<Resource Group name>')
237
- availability_sets.each do |availability_set|
238
- puts "#{availability_set.name}"
239
- puts "#{availability_set.location}"
240
- end
299
+ fog_compute_service.managed_disks.create(
300
+ name: '<Disk Name>',
301
+ location: '<Location>',
302
+ resource_group_name: '<Resource Group Name>',
303
+ account_type: '<Storage Account Type>',
304
+ disk_size_gb: <Disk Size in GBs>,
305
+ creation_data: {
306
+ create_option: '<Create Option Value>'
307
+ }
308
+ )
241
309
  ```
242
310
 
243
- ## Retrieve a single Availability Set
311
+ ## Attach a Managed Data Disk to Server
244
312
 
245
- Get a single record of Availability Set
313
+ Get the server object and attach a Data Disk to it.
246
314
 
247
315
  ```ruby
248
- availability_set = azure_compute_service
249
- .availability_sets
250
- .get('<Resource Group name>','<Availability Set name>')
251
- puts "#{availability_set.name}"
316
+ server.attach_managed_disk('<Disk Name>', '<Disk Resource Group Name>')
252
317
  ```
253
318
 
254
- ## Destroy a single Availability Set
319
+ ## Detach a Managed Data Disk from Server
255
320
 
256
- Get an availability set object from the get method and then destroy that availability set.
321
+ Get the server object and detach a Data Disk from it.
257
322
 
258
323
  ```ruby
259
- availability_set.destroy
324
+ server.detach_managed_disk('<Disk Name>')
260
325
  ```
261
326
 
262
- ## Check Virtual Machine Extension Existence
327
+ ## List Managed Disks in a Resource Group
328
+
329
+ List managed disks in a resource group
263
330
 
264
331
  ```ruby
265
- azure_compute_service.virtual_machine_extensions.check_vm_extension_exists(<Resource Group name>, <Virtual Machine Name>, <Extension Name>)
332
+ managed_disks = fog_compute_service.managed_disks(resource_group: '<Resource Group Name>')
333
+ mnaged_disks.each do |disk|
334
+ puts "#{disk.name}"
335
+ puts "#{disk.location}"
336
+ end
266
337
  ```
267
338
 
268
- ## Create Virtual Machine Extension
339
+ ## List Managed Disks in a Subscription
269
340
 
270
- Installs an extension to the specified virtual machine.
341
+ List managed disks in a subscription
271
342
 
272
343
  ```ruby
273
- azure_compute_service.virtual_machine_extensions.create(
274
- name: <Extension Name>,
275
- resource_group: <Resource Group>,
276
- location: <Location>,
277
- vm_name: <Virtual Machine Name>, # Extension will be installed on this VM
278
- publisher: <Extension publisher>,
279
- type: <Extension type>,
280
- type_handler_version: <Extension version>,
281
- auto_upgrade_minor_version: <true|false>, # Optional
282
- settings: {JSON object}, # Format: {"key": "value", "key": {"key": "value"}}
283
- protected_settings: {JSON object}
284
- )
344
+ fog_compute_service.managed_disks.each do |disk|
345
+ puts "#{disk.name}"
346
+ puts "#{disk.location}"
347
+ end
285
348
  ```
286
349
 
287
- ## Get Extension from Virtual Machine
350
+ ## Grant Access to a Managed Disk
288
351
 
289
- Retrieves the given extension from the virtual machine
352
+ Grant access to a managed disk
290
353
 
291
354
  ```ruby
292
- vm_extension = azure_compute_service.virtual_machine_extensions.get(
293
- '<Resource Group Name>', '<Virtual Machine Name>', '<Extension Name>'
294
- )
355
+ access_sas = fog_compute_service.managed_disks.grant_access('<Resource Group Name>', '<Disk Name>', '<Access Type>', <Duration in Seconds>)
356
+ puts "Access SAS: #{access_sas}"
295
357
  ```
296
358
 
297
- ## Update Extension
359
+ ## Revoke Access from a Managed Disk
298
360
 
299
- Update the given extension. The attributes that can be modified are
300
- - auto_upgrade_minor_version
301
- - settings
302
- - protected_settings
361
+ Revoke access from a managed disk
303
362
 
304
363
  ```ruby
305
- vm_extension.update(
306
- auto_upgrade_minor_version: <true|false>,
307
- settings: {JSON object},
308
- protected_settings: {JSON object}
309
- )
364
+ response = fog_compute_service.managed_disks.revoke_access('<Resource Group Name>', '<Disk Name>')
365
+ puts "Revoke Access response status: #{response.status}"
310
366
  ```
311
367
 
312
- ## Destroy Extension
368
+ ## Check Managed Disk Existence
313
369
 
314
- Destroy the given extension from the virtual machine
370
+ ```ruby
371
+ fog_compute_service.managed_disks.check_managed_disk_exists('<Resource Group Name>', '<Disk Name>')
372
+ ```
373
+
374
+ ## Retrieve a single Managed Disk
375
+
376
+ Get a single record of managed disks
315
377
 
316
378
  ```ruby
317
- vm_extension.destroy
379
+ managed_disk = fog_compute_service
380
+ .managed_disks
381
+ .get('<Resource Group Name>', '<Disk Name>')
382
+ puts "#{managed_disk.name}"
318
383
  ```
319
384
 
385
+ ## Destroy a single Managed Disk
320
386
 
321
- ## Create Managed Disk
387
+ Get an managed disk object from the get method and then destroy that managed disk.
322
388
 
323
- Create a new Managed Disk
389
+ ```ruby
390
+ managed_disk.destroy
391
+ ```
392
+
393
+ ## Check Availability Set Existence
324
394
 
325
395
  ```ruby
326
- azure_compute_service.managed_disks.create(
327
- name: 'disk_name',
328
- location: 'east us',
329
- resource_group_name: 'resource_group_name',
330
- account_type: 'Premium_LRS',
331
- disk_size_gb: 1023,
332
- creation_data: {
333
- create_option: 'Empty'
334
- }
335
- )
396
+ fog_compute_service.availability_sets.check_availability_set_exists('<Resource Group Name>', '<Availability Set Name>')
336
397
  ```
337
398
 
338
- ## List Managed Disks in a Resource Group
399
+ ## Create Availability Set
339
400
 
340
- List managed disks in a resource group
401
+ Create a new availability set
341
402
 
342
403
  ```ruby
343
- managed_disks = azure_compute_service.managed_disks(resource_group: '<Resource Group name>')
344
- mnaged_disks.each do |disk|
345
- puts "#{disk.name}"
346
- puts "#{disk.location}"
347
- end
404
+ fog_compute_service.availability_sets.create(
405
+ name: '<Availability Set Name>',
406
+ location: '<Location>',
407
+ resource_group: '<Resource Group Name>'
408
+ platform_fault_domain_count: <No of Fault Domains>, # [Optional] Default => 2
409
+ platform_update_domain_count: <No of Update Domains>, # [Optional] Default => 5
410
+ use_managed_disk: true # [Optional] Possible values true or false
411
+ )
348
412
  ```
413
+ ## List Availability Sets
349
414
 
350
- ## List Managed Disks in a Subscription
351
-
352
- List managed disks in a subscription
415
+ List availability sets in a resource group
353
416
 
354
417
  ```ruby
355
- azure_compute_service.managed_disks.each do |disk|
356
- puts "#{disk.name}"
357
- puts "#{disk.location}"
358
- end
418
+ availability_sets = fog_compute_service.availability_sets(resource_group: '<Resource Group Name>')
419
+ availability_sets.each do |availability_set|
420
+ puts "#{availability_set.name}"
421
+ puts "#{availability_set.location}"
422
+ end
359
423
  ```
360
424
 
361
- ## Grant Access to a Managed Disk
425
+ ## Retrieve a single Availability Set
362
426
 
363
- Grant access to a managed disk
427
+ Get a single record of Availability Set
364
428
 
365
429
  ```ruby
366
- access_sas = azure_compute_service.managed_disks.grant_access('<resource_group_name>', '<disk_name>', 'Read', 1000)
367
- puts "Access SAS: #{access_sas}"
430
+ availability_set = fog_compute_service
431
+ .availability_sets
432
+ .get('<Resource Group Name>','<Availability Set Name>')
433
+ puts "#{availability_set.name}"
368
434
  ```
369
435
 
370
- ## Revoke Access from a Managed Disk
436
+ ## Destroy a single Availability Set
371
437
 
372
- Revoke access from a managed disk
438
+ Get an availability set object from the get method and then destroy that availability set.
373
439
 
374
440
  ```ruby
375
- response = azure_compute_service.managed_disks.revoke_access('<resource_group_name>', '<disk_name>')
376
- puts "Revoke Access response status: #{response.status}"
441
+ availability_set.destroy
377
442
  ```
378
443
 
379
- ## Check Managed Disk Existence
444
+ ## Check Virtual Machine Extension Existence
380
445
 
381
446
  ```ruby
382
- azure_compute_service.managed_disks.check_managed_disk_exists(<Resource Group name>, <Disk name>)
447
+ fog_compute_service.virtual_machine_extensions.check_vm_extension_exists('<Resource Group Name>', '<Virtual Machine Name>', '<Extension Name>')
383
448
  ```
384
449
 
385
- ## Retrieve a single Managed Disk
450
+ ## Create Virtual Machine Extension
386
451
 
387
- Get a single record of managed disks
452
+ Installs an extension to the specified virtual machine.
388
453
 
389
454
  ```ruby
390
- managed_disk = azure_compute_service
391
- .managed_disks
392
- .get('<Resource Group name>','<Disk name>')
393
- puts "#{managed_disk.name}"
455
+ fog_compute_service.virtual_machine_extensions.create(
456
+ name: '<Extension Name>',
457
+ resource_group: '<Resource Group Name>',
458
+ location: '<Location>',
459
+ vm_name: '<Virtual Machine Name>', # Extension will be installed on this VM
460
+ publisher: '<Extension Publisher>',
461
+ type: '<Extension Type>',
462
+ type_handler_version: '<Extension Version>',
463
+ settings: {JSON object}, # Format: {"key": "value", "key": {"key": "value"}}
464
+ protected_settings: {JSON object},
465
+ auto_upgrade_minor_version: <True/False> , # Optional
466
+ )
394
467
  ```
395
468
 
396
- ## Destroy a single Managed Disk
469
+ ## Get Extension from Virtual Machine
397
470
 
398
- Get an managed disk object from the get method and then destroy that managed disk.
471
+ Retrieves the given extension from the virtual machine
399
472
 
400
473
  ```ruby
401
- managed_disk.destroy
474
+ vm_extension = fog_compute_service.virtual_machine_extensions.get(
475
+ '<Resource Group Name>', '<Virtual Machine Name>', '<Extension Name>'
476
+ )
402
477
  ```
403
478
 
479
+ ## Update Extension
480
+
481
+ Update the given extension. The attributes that can be modified are
482
+ - auto_upgrade_minor_version
483
+ - settings
484
+ - protected_settings
485
+
486
+ ```ruby
487
+ vm_extension.update(
488
+ auto_upgrade_minor_version: <True/False>,
489
+ settings: {JSON object},
490
+ protected_settings: {JSON object}
491
+ )
492
+ ```
493
+
494
+ ## Destroy Extension
495
+
496
+ Destroy the given extension from the virtual machine
497
+
498
+ ```ruby
499
+ vm_extension.destroy
500
+ ```
404
501
 
405
502
  ## Support and Feedback
406
503
  Your feedback is appreciated! If you have specific issues with the fog ARM, you should file an issue via Github.