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.
- checksums.yaml +4 -4
- data/.arclint +8 -0
- data/.travis.yml +28 -14
- data/CHANGELOG.md +77 -0
- data/CONTRIBUTORS.md +4 -0
- data/fog-azure-rm.gemspec +3 -2
- data/lib/fog/azurerm.rb +1 -0
- data/lib/fog/azurerm/async_response.rb +9 -1
- data/lib/fog/azurerm/compute.rb +3 -1
- data/lib/fog/azurerm/constants.rb +11 -3
- data/lib/fog/azurerm/dns.rb +3 -1
- data/lib/fog/azurerm/docs/application_gateway.md +119 -117
- data/lib/fog/azurerm/docs/compute.md +299 -202
- data/lib/fog/azurerm/docs/dns.md +44 -43
- data/lib/fog/azurerm/docs/key_vault.md +31 -28
- data/lib/fog/azurerm/docs/network.md +407 -404
- data/lib/fog/azurerm/docs/resources.md +52 -49
- data/lib/fog/azurerm/docs/sql.md +56 -54
- data/lib/fog/azurerm/docs/storage.md +92 -157
- data/lib/fog/azurerm/docs/traffic_manager.md +55 -53
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +5 -1
- data/lib/fog/azurerm/models/compute/availability_set.rb +4 -1
- data/lib/fog/azurerm/models/compute/managed_disk.rb +0 -1
- data/lib/fog/azurerm/models/compute/server.rb +61 -11
- data/lib/fog/azurerm/models/compute/servers.rb +2 -2
- data/lib/fog/azurerm/models/dns/a_record.rb +15 -0
- data/lib/fog/azurerm/models/dns/cname_record.rb +15 -0
- data/lib/fog/azurerm/models/dns/record_set.rb +20 -8
- data/lib/fog/azurerm/models/key_vault/vault.rb +3 -1
- data/lib/fog/azurerm/models/network/load_balancer.rb +3 -1
- data/lib/fog/azurerm/models/network/local_network_gateway.rb +3 -1
- data/lib/fog/azurerm/models/network/network_interface.rb +3 -1
- data/lib/fog/azurerm/models/network/network_security_group.rb +4 -2
- data/lib/fog/azurerm/models/network/public_ip.rb +4 -2
- data/lib/fog/azurerm/models/network/virtual_network.rb +4 -2
- data/lib/fog/azurerm/models/resources/resource_group.rb +3 -1
- data/lib/fog/azurerm/models/sql/sql_database.rb +3 -3
- data/lib/fog/azurerm/models/sql/sql_server.rb +3 -2
- data/lib/fog/azurerm/models/storage/directories.rb +6 -1
- data/lib/fog/azurerm/models/storage/file.rb +2 -0
- data/lib/fog/azurerm/models/storage/storage_account.rb +4 -1
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +7 -0
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +3 -1
- data/lib/fog/azurerm/requests/application_gateway/check_ag_exists.rb +1 -1
- data/lib/fog/azurerm/requests/application_gateway/create_or_update_application_gateway.rb +1 -0
- data/lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb +2 -2
- data/lib/fog/azurerm/requests/compute/check_availability_set_exists.rb +1 -1
- data/lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb +1 -1
- data/lib/fog/azurerm/requests/compute/check_vm_exists.rb +1 -1
- data/lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb +2 -2
- data/lib/fog/azurerm/requests/compute/create_availability_set.rb +4 -2
- data/lib/fog/azurerm/requests/compute/create_image.rb +68 -0
- data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +302 -135
- data/lib/fog/azurerm/requests/compute/delete_image.rb +29 -0
- data/lib/fog/azurerm/requests/compute/get_image.rb +45 -0
- data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/dns/check_record_set_exists.rb +1 -1
- data/lib/fog/azurerm/requests/dns/check_zone_exists.rb +3 -2
- data/lib/fog/azurerm/requests/dns/create_or_update_record_set.rb +3 -2
- data/lib/fog/azurerm/requests/dns/create_or_update_zone.rb +1 -2
- data/lib/fog/azurerm/requests/key_vault/check_vault_exists.rb +1 -1
- data/lib/fog/azurerm/requests/key_vault/create_or_update_vault.rb +1 -0
- data/lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_load_balancer_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_network_interface_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_public_ip_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_subnet_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_virtual_network_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_load_balancer.rb +4 -4
- data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +1 -2
- data/lib/fog/azurerm/requests/network/create_or_update_network_interface.rb +4 -3
- data/lib/fog/azurerm/requests/network/create_or_update_network_security_group.rb +4 -3
- data/lib/fog/azurerm/requests/network/create_or_update_public_ip.rb +5 -3
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb +4 -3
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +1 -1
- data/lib/fog/azurerm/requests/resources/check_azure_resource_exists.rb +4 -4
- data/lib/fog/azurerm/requests/resources/create_resource_group.rb +2 -1
- data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +4 -4
- data/lib/fog/azurerm/requests/resources/tag_resource.rb +4 -4
- data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +13 -10
- data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +8 -5
- data/lib/fog/azurerm/requests/storage/check_storage_account_exists.rb +1 -1
- data/lib/fog/azurerm/requests/storage/create_storage_account.rb +4 -2
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb +1 -1
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb +1 -1
- data/lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_profile.rb +13 -3
- data/lib/fog/azurerm/storage.rb +0 -18
- data/lib/fog/azurerm/utilities/general.rb +21 -10
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +7 -1
- data/rakefile +1 -1
- data/test/api_stub.rb +19 -2
- data/test/api_stub/models/compute/server.rb +21 -5
- data/test/api_stub/requests/compute/image.rb +41 -0
- data/test/api_stub/requests/compute/virtual_machine.rb +60 -62
- data/test/api_stub/requests/resources/resource_group.rb +1 -1
- data/test/integration/application_gateway.rb +8 -1
- data/test/integration/availability_set.rb +9 -2
- data/test/integration/external_load_balancer.rb +2 -1
- data/test/integration/internal_load_balancer.rb +2 -1
- data/test/integration/key_vault.rb +2 -1
- data/test/integration/managed_disk.rb +10 -5
- data/test/integration/network_interface.rb +2 -1
- data/test/integration/network_security_group.rb +2 -1
- data/test/integration/public_ip.rb +2 -1
- data/test/integration/record_set.rb +5 -5
- data/test/integration/resource_group.rb +5 -2
- data/test/integration/resource_tag.rb +4 -2
- data/test/integration/server.rb +113 -23
- data/test/integration/server_custom_image.rb +120 -20
- data/test/integration/sql_server.rb +10 -2
- data/test/integration/storage_account.rb +32 -20
- data/test/integration/traffic_manager.rb +6 -1
- data/test/integration/virtual_network.rb +2 -1
- data/test/integration/virtual_network_gateway_connection.rb +3 -3
- data/test/models/application_gateway/test_gateway.rb +2 -1
- data/test/models/compute/test_availability_set.rb +2 -1
- data/test/models/compute/test_managed_disk.rb +2 -1
- data/test/models/compute/test_server.rb +13 -4
- data/test/models/dns/test_zone.rb +2 -1
- data/test/models/key_vault/test_vault.rb +2 -1
- data/test/models/network/test_load_balancer.rb +2 -1
- data/test/models/network/test_network_interface.rb +2 -1
- data/test/models/network/test_network_security_group.rb +2 -1
- data/test/models/network/test_public_ip.rb +2 -1
- data/test/models/network/test_virtual_network.rb +2 -1
- data/test/models/resources/test_resource_group.rb +2 -1
- data/test/models/sql/test_database.rb +2 -1
- data/test/models/sql/test_sql_server.rb +2 -1
- data/test/models/storage/test_storage_account.rb +2 -1
- data/test/models/traffic_manager/test_traffic_manager_profile.rb +2 -1
- data/test/requests/application_gateway/test_check_ag_exists.rb +11 -4
- data/test/requests/compute/test_attach_data_disk_to_vm.rb +2 -2
- data/test/requests/compute/test_check_availability_set_exists.rb +9 -2
- data/test/requests/compute/test_check_managed_disk_exists.rb +9 -2
- data/test/requests/compute/test_check_vm_exists.rb +9 -2
- data/test/requests/compute/test_check_vm_extension_exists.rb +9 -2
- data/test/requests/compute/test_create_image.rb +27 -0
- data/test/requests/compute/test_create_virtual_machine.rb +41 -17
- data/test/requests/compute/test_delete_image.rb +23 -0
- data/test/requests/compute/test_get_image.rb +23 -0
- data/test/requests/dns/test_check_record_set_exists.rb +9 -2
- data/test/requests/dns/test_check_zone_exists.rb +16 -2
- data/test/requests/key_vault/test_check_vault_exists.rb +9 -2
- data/test/requests/network/test_check_express_route_cir_auth_exists.rb +9 -2
- data/test/requests/network/test_check_express_route_circuit_exists.rb +9 -2
- data/test/requests/network/test_check_load_balancer_exists.rb +9 -2
- data/test/requests/network/test_check_local_net_gateway_exists.rb +11 -4
- data/test/requests/network/test_check_net_sec_group_exists.rb +9 -2
- data/test/requests/network/test_check_net_sec_rule_exists.rb +9 -2
- data/test/requests/network/test_check_network_interface_exists.rb +9 -2
- data/test/requests/network/test_check_public_ip_exists.rb +9 -2
- data/test/requests/network/test_check_subnet_exists.rb +9 -2
- data/test/requests/network/test_check_virtual_network_exists.rb +10 -4
- data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +9 -2
- data/test/requests/network/test_check_vnet_gateway_exists.rb +9 -2
- data/test/requests/network/test_create_load_balancer.rb +3 -2
- data/test/requests/network/test_create_network_interface.rb +4 -3
- data/test/requests/network/test_create_or_update_network_security_group.rb +3 -2
- data/test/requests/network/test_create_or_update_virtual_network.rb +5 -3
- data/test/requests/network/test_create_public_ip.rb +3 -2
- data/test/requests/network/test_update_public_ip.rb +3 -2
- data/test/requests/resources/test_create_resource_group.rb +3 -2
- data/test/requests/resources/test_delete_resource_tag.rb +3 -3
- data/test/requests/resources/test_tag_resource.rb +3 -3
- data/test/requests/storage/test_check_storage_account_exists.rb +8 -1
- data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +9 -2
- data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +9 -2
- data/test/test_helper.rb +5 -14
- metadata +67 -75
- data/lib/fog/azurerm/models/storage/recovery_vault.rb +0 -50
- data/lib/fog/azurerm/models/storage/recovery_vaults.rb +0 -27
- data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +0 -54
- data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +0 -35
- data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +0 -60
- data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +0 -61
- data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +0 -56
- data/lib/fog/azurerm/requests/storage/get_backup_container.rb +0 -53
- data/lib/fog/azurerm/requests/storage/get_backup_item.rb +0 -58
- data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +0 -53
- data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +0 -64
- data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +0 -49
- data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +0 -48
- data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +0 -36
- data/lib/fog/azurerm/requests/storage/start_backup.rb +0 -54
- data/test/api_stub/models/storage/recovery_vault.rb +0 -23
- data/test/api_stub/requests/storage/recovery_vault.rb +0 -189
- data/test/models/storage/test_recovery_vault.rb +0 -61
- data/test/models/storage/test_recovery_vaults.rb +0 -47
- data/test/requests/storage/test_create_recovery_vault.rb +0 -35
- data/test/requests/storage/test_delete_recovery_vault.rb +0 -34
- data/test/requests/storage/test_disable_backup_protection.rb +0 -52
- data/test/requests/storage/test_enable_backup_protection.rb +0 -66
- data/test/requests/storage/test_get_all_backup_jobs.rb +0 -35
- data/test/requests/storage/test_get_backup_container.rb +0 -35
- data/test/requests/storage/test_get_backup_item.rb +0 -35
- data/test/requests/storage/test_get_backup_job_for_vm.rb +0 -26
- data/test/requests/storage/test_get_backup_protection_policy.rb +0 -35
- data/test/requests/storage/test_get_recovery_vault.rb +0 -35
- data/test/requests/storage/test_list_recovery_vault.rb +0 -35
- data/test/requests/storage/test_set_recovery_vault_context.rb +0 -34
- 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
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
81
|
+
fog_compute_service.servers.create(
|
46
82
|
name: '<VM Name>',
|
47
|
-
location: '
|
83
|
+
location: '<Location>',
|
48
84
|
resource_group: '<Resource Group Name>',
|
49
|
-
|
50
|
-
|
51
|
-
username: '<Username
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
custom_data: '
|
63
|
-
os_disk_caching:
|
64
|
-
managed_disk_storage_type:
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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: '
|
111
|
+
location: '<Location>',
|
74
112
|
resource_group: '<Resource Group Name>',
|
75
|
-
|
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
|
78
|
-
password: '<Password
|
79
|
-
disable_password_authentication:
|
80
|
-
network_interface_card_ids: ['/subscriptions
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
vhd_path: '<Path of VHD>',
|
88
|
-
custom_data: '
|
89
|
-
|
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
|
-
|
138
|
+
async_response = fog_compute_service.servers.create_async(
|
99
139
|
name: '<VM Name>',
|
100
|
-
location: '
|
140
|
+
location: '<Location>',
|
101
141
|
resource_group: '<Resource Group Name>',
|
102
|
-
|
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
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
vhd_path: '<Path of VHD>',
|
115
|
-
custom_data: '
|
116
|
-
os_disk_caching:
|
117
|
-
managed_disk_storage_type:
|
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
|
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
|
-
|
158
|
-
|
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
|
-
|
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
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
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
|
-
##
|
218
|
+
## Get a Server's status
|
176
219
|
|
177
|
-
|
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
|
-
|
232
|
+
server.start
|
181
233
|
```
|
182
234
|
|
183
|
-
##
|
235
|
+
## Power Off a Server
|
236
|
+
```ruby
|
237
|
+
server.power_off
|
238
|
+
```
|
184
239
|
|
185
|
-
|
240
|
+
## Restart a Server
|
241
|
+
```ruby
|
242
|
+
server.restart
|
243
|
+
```
|
186
244
|
|
245
|
+
## Deallocate a Server
|
187
246
|
```ruby
|
188
|
-
|
247
|
+
server.deallocate
|
189
248
|
```
|
190
249
|
|
191
|
-
##
|
250
|
+
## Redeploy a Server
|
251
|
+
```ruby
|
252
|
+
server.redeploy
|
253
|
+
```
|
192
254
|
|
193
|
-
|
255
|
+
## Destroy a single Server
|
194
256
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
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
|
-
##
|
263
|
+
## Attach a Data Disk to Server
|
204
264
|
|
205
|
-
Get
|
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
|
-
|
268
|
+
server.attach_data_disk('<Disk Name>', <Size in GBs>, '<Storage Account Name>')
|
209
269
|
```
|
210
270
|
|
211
|
-
##
|
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
|
-
|
276
|
+
server.detach_data_disk('<Disk Name>')
|
215
277
|
```
|
216
278
|
|
217
|
-
## Create
|
279
|
+
## Create Managed Disk
|
218
280
|
|
219
|
-
Create a new
|
281
|
+
Create a new Premium Managed Disk
|
220
282
|
|
221
283
|
```ruby
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
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
|
-
|
296
|
+
Create a new Standard Managed Disk
|
234
297
|
|
235
298
|
```ruby
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
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
|
-
##
|
311
|
+
## Attach a Managed Data Disk to Server
|
244
312
|
|
245
|
-
Get a
|
313
|
+
Get the server object and attach a Data Disk to it.
|
246
314
|
|
247
315
|
```ruby
|
248
|
-
|
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
|
-
##
|
319
|
+
## Detach a Managed Data Disk from Server
|
255
320
|
|
256
|
-
Get
|
321
|
+
Get the server object and detach a Data Disk from it.
|
257
322
|
|
258
323
|
```ruby
|
259
|
-
|
324
|
+
server.detach_managed_disk('<Disk Name>')
|
260
325
|
```
|
261
326
|
|
262
|
-
##
|
327
|
+
## List Managed Disks in a Resource Group
|
328
|
+
|
329
|
+
List managed disks in a resource group
|
263
330
|
|
264
331
|
```ruby
|
265
|
-
|
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
|
-
##
|
339
|
+
## List Managed Disks in a Subscription
|
269
340
|
|
270
|
-
|
341
|
+
List managed disks in a subscription
|
271
342
|
|
272
343
|
```ruby
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
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
|
-
##
|
350
|
+
## Grant Access to a Managed Disk
|
288
351
|
|
289
|
-
|
352
|
+
Grant access to a managed disk
|
290
353
|
|
291
354
|
```ruby
|
292
|
-
|
293
|
-
|
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
|
-
##
|
359
|
+
## Revoke Access from a Managed Disk
|
298
360
|
|
299
|
-
|
300
|
-
- auto_upgrade_minor_version
|
301
|
-
- settings
|
302
|
-
- protected_settings
|
361
|
+
Revoke access from a managed disk
|
303
362
|
|
304
363
|
```ruby
|
305
|
-
|
306
|
-
|
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
|
-
##
|
368
|
+
## Check Managed Disk Existence
|
313
369
|
|
314
|
-
|
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
|
-
|
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
|
-
|
387
|
+
Get an managed disk object from the get method and then destroy that managed disk.
|
322
388
|
|
323
|
-
|
389
|
+
```ruby
|
390
|
+
managed_disk.destroy
|
391
|
+
```
|
392
|
+
|
393
|
+
## Check Availability Set Existence
|
324
394
|
|
325
395
|
```ruby
|
326
|
-
|
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
|
-
##
|
399
|
+
## Create Availability Set
|
339
400
|
|
340
|
-
|
401
|
+
Create a new availability set
|
341
402
|
|
342
403
|
```ruby
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
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
|
-
|
351
|
-
|
352
|
-
List managed disks in a subscription
|
415
|
+
List availability sets in a resource group
|
353
416
|
|
354
417
|
```ruby
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
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
|
-
##
|
425
|
+
## Retrieve a single Availability Set
|
362
426
|
|
363
|
-
|
427
|
+
Get a single record of Availability Set
|
364
428
|
|
365
429
|
```ruby
|
366
|
-
|
367
|
-
|
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
|
-
##
|
436
|
+
## Destroy a single Availability Set
|
371
437
|
|
372
|
-
|
438
|
+
Get an availability set object from the get method and then destroy that availability set.
|
373
439
|
|
374
440
|
```ruby
|
375
|
-
|
376
|
-
puts "Revoke Access response status: #{response.status}"
|
441
|
+
availability_set.destroy
|
377
442
|
```
|
378
443
|
|
379
|
-
## Check
|
444
|
+
## Check Virtual Machine Extension Existence
|
380
445
|
|
381
446
|
```ruby
|
382
|
-
|
447
|
+
fog_compute_service.virtual_machine_extensions.check_vm_extension_exists('<Resource Group Name>', '<Virtual Machine Name>', '<Extension Name>')
|
383
448
|
```
|
384
449
|
|
385
|
-
##
|
450
|
+
## Create Virtual Machine Extension
|
386
451
|
|
387
|
-
|
452
|
+
Installs an extension to the specified virtual machine.
|
388
453
|
|
389
454
|
```ruby
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
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
|
-
##
|
469
|
+
## Get Extension from Virtual Machine
|
397
470
|
|
398
|
-
|
471
|
+
Retrieves the given extension from the virtual machine
|
399
472
|
|
400
473
|
```ruby
|
401
|
-
|
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.
|