fog-azure-rm 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +2 -1
- data/CHANGELOG.md +8 -0
- data/lib/fog/azurerm/async_response.rb +6 -1
- data/lib/fog/azurerm/docs/application_gateway.md +119 -116
- data/lib/fog/azurerm/docs/compute.md +219 -217
- data/lib/fog/azurerm/docs/dns.md +43 -45
- data/lib/fog/azurerm/docs/key_vault.md +31 -31
- data/lib/fog/azurerm/docs/network.md +403 -405
- data/lib/fog/azurerm/docs/resources.md +51 -51
- data/lib/fog/azurerm/docs/sql.md +51 -51
- data/lib/fog/azurerm/docs/storage.md +89 -88
- data/lib/fog/azurerm/docs/traffic_manager.md +55 -54
- data/lib/fog/azurerm/models/compute/server.rb +6 -0
- data/lib/fog/azurerm/models/compute/servers.rb +1 -1
- data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +7 -1
- data/rakefile +1 -1
- data/test/api_stub/models/compute/server.rb +16 -0
- data/test/models/compute/test_server.rb +7 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 34ee4dc155b1227329c3833c1bf6c3a0603f6f91ffaf06702a82c649b5588c7b
|
4
|
+
data.tar.gz: cea157198db03ed7f9aba2af3ef1cea364db7b1109d3d98aa9c937af76fb8e95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85c0c89befd15482cc097393860ded6df9b49b764e3f9cc5047b4c84f33d2c743eed347c81ba12566c11cc50900a4532f66cc60f86a81b3c7edf595cb4c4fd3c
|
7
|
+
data.tar.gz: b5a0704f2f32bc8f8d1cd4ad51384b4d10aedabc10a67dc6a90c747a4ede66870fa3f55b88c951f59cd5bbc5c7558704a2d738ec6fa7e34be71f0b005a1a7187
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,16 +2,21 @@ module Fog
|
|
2
2
|
module AzureRM
|
3
3
|
# class for Async Response
|
4
4
|
class AsyncResponse
|
5
|
-
def initialize(model, promise, delete_extra_resource = false)
|
5
|
+
def initialize(model, promise, delete_extra_resource = false, post_method_execute = nil)
|
6
6
|
@fog_model = model
|
7
7
|
@promise = promise
|
8
8
|
@delete_extra_resource = delete_extra_resource
|
9
|
+
@post_method_execute = post_method_execute
|
9
10
|
end
|
10
11
|
|
11
12
|
def value
|
12
13
|
response = @promise.value.body
|
13
14
|
@fog_model.merge_attributes(@fog_model.class.parse(response))
|
14
15
|
@fog_model.delete_extra_resources if @delete_extra_resource
|
16
|
+
# This code block will execute the method mentioned in post_method_execute after getting the response
|
17
|
+
unless @post_method_execute.nil?
|
18
|
+
@fog_model.public_send(@post_method_execute) if @fog_model.respond_to? @post_method_execute
|
19
|
+
end
|
15
20
|
@fog_model
|
16
21
|
end
|
17
22
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Application Gateway
|
2
2
|
|
3
|
-
This document explains how to get started using Azure Network Service with Fog to manage Application Gateway. With this gem you can create
|
3
|
+
This document explains how to get started using Azure Network Service with Fog to manage Application Gateway. With this gem you can create, update, list or delete Application Gateway.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
@@ -14,19 +14,20 @@ require 'fog/azurerm'
|
|
14
14
|
Next, create a connection to the Application Gateway Service:
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
|
18
|
-
tenant_id: '<
|
19
|
-
client_id: '<
|
20
|
-
client_secret: '<
|
21
|
-
subscription_id: '<
|
22
|
-
environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>'
|
17
|
+
fog_application_gateway_service = Fog::ApplicationGateway::AzureRM.new(
|
18
|
+
tenant_id: '<Tenant Id>', # Tenant Id of Azure Active Directory Application
|
19
|
+
client_id: '<Client Id>', # Client Id of Azure Active Directory Application
|
20
|
+
client_secret: '<Client Secret>', # Client Secret of Azure Active Directory Application
|
21
|
+
subscription_id: '<Subscription Id>', # Subscription Id of an Azure Account
|
22
|
+
environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
|
23
23
|
)
|
24
24
|
```
|
25
25
|
|
26
26
|
## Check Application Gateway Existence
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
|
29
|
+
fog_application_gateway_service.gateways.check_application_gateway_exists('<Resource Group Name>', '<Gateway Name>')
|
30
|
+
|
30
31
|
```
|
31
32
|
|
32
33
|
## Create Application Gateway
|
@@ -34,44 +35,44 @@ azure_application_gateway_service.gateways.check_application_gateway_exists(<Res
|
|
34
35
|
Create a new Application Gateway.
|
35
36
|
|
36
37
|
```ruby
|
37
|
-
|
38
|
+
gateway = fog_application_gateway_service.gateways.create(
|
39
|
+
|
38
40
|
name: '<Gateway Name>',
|
39
|
-
location: '
|
41
|
+
location: '<Location>',
|
40
42
|
resource_group: '<Resource Group name>',
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
sku_capacity: '2',
|
43
|
+
sku_name: '<SKU Name>',
|
44
|
+
sku_tier: '<SKU Tier>',
|
45
|
+
sku_capacity: '<SKU Capacity>',
|
45
46
|
gateway_ip_configurations:
|
46
47
|
[
|
47
48
|
{
|
48
|
-
name: '
|
49
|
-
subnet_id: '/subscriptions/<
|
49
|
+
name: '<Gateway IP Config Name>',
|
50
|
+
subnet_id: '/subscriptions/<Subscription Id>/resourcegroups/<Resource Group Name>/providers/Microsoft.Network/virtualNetworks/<Virtual Network Name>/subnets/<Subnet Name>'
|
50
51
|
}
|
51
52
|
],
|
52
53
|
frontend_ip_configurations:
|
53
54
|
[
|
54
55
|
{
|
55
|
-
name: '
|
56
|
-
private_ip_allocation_method:
|
57
|
-
public_ip_address_id: '/subscriptions/<
|
58
|
-
private_ip_address: '
|
56
|
+
name: '<Frontend IP Config Name>',
|
57
|
+
private_ip_allocation_method: '<IP Allocation Method>',
|
58
|
+
public_ip_address_id: '/subscriptions/<Subscription Id>/resourcegroups/<Resource Group Name>/providers/Microsoft.Network/publicIPAddresses/<Public IP Address Name>',
|
59
|
+
private_ip_address: '<IP Address>'
|
59
60
|
}
|
60
61
|
],
|
61
62
|
frontend_ports:
|
62
63
|
[
|
63
64
|
{
|
64
|
-
name: '
|
65
|
-
port:
|
65
|
+
name: '<Frontend Port Name>',
|
66
|
+
port: <Port Number>
|
66
67
|
}
|
67
68
|
],
|
68
69
|
backend_address_pools:
|
69
70
|
[
|
70
71
|
{
|
71
|
-
name: '
|
72
|
+
name: '<Backend Address Pool Name>',
|
72
73
|
ip_addresses: [
|
73
74
|
{
|
74
|
-
ipAddress: '
|
75
|
+
ipAddress: '<IP Address>'
|
75
76
|
}
|
76
77
|
]
|
77
78
|
}
|
@@ -79,74 +80,74 @@ Create a new Application Gateway.
|
|
79
80
|
backend_http_settings_list:
|
80
81
|
[
|
81
82
|
{
|
82
|
-
name: '
|
83
|
-
port:
|
84
|
-
protocol: '
|
85
|
-
cookie_based_affinity: 'Enabled',
|
86
|
-
request_timeout: '
|
83
|
+
name: '<Gateway Settings Name>',
|
84
|
+
port: <Port Number>,
|
85
|
+
protocol: '<Protocol Name>',
|
86
|
+
cookie_based_affinity: '<Enabled/Disabled>',
|
87
|
+
request_timeout: '<Timeout Time>'
|
87
88
|
}
|
88
89
|
],
|
89
90
|
http_listeners:
|
90
91
|
[
|
91
92
|
{
|
92
|
-
name: '
|
93
|
-
frontend_ip_config_id: '/subscriptions/<
|
94
|
-
frontend_port_id: '/subscriptions/<
|
95
|
-
protocol: '
|
93
|
+
name: '<Gateway Listener Name>',
|
94
|
+
frontend_ip_config_id: '/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/frontendIPConfigurations/<Frontend IP Config Name>',
|
95
|
+
frontend_port_id: '/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/frontendPorts/<Frontend Port Name>',
|
96
|
+
protocol: '<Protocol Name>',
|
96
97
|
host_name: '',
|
97
|
-
require_server_name_indication: '
|
98
|
+
require_server_name_indication: '<True/False>'
|
98
99
|
}
|
99
100
|
],
|
100
101
|
request_routing_rules:
|
101
102
|
[
|
102
103
|
{
|
103
|
-
name: '
|
104
|
-
type: '
|
105
|
-
http_listener_id: '/subscriptions/<
|
106
|
-
backend_address_pool_id: '/subscriptions/<
|
107
|
-
backend_http_settings_id: '/subscriptions/<
|
104
|
+
name: '<Gateway Request Route Rule Name>',
|
105
|
+
type: '<Type>',
|
106
|
+
http_listener_id: '/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/httpListeners/<Gateway Listener Name>',
|
107
|
+
backend_address_pool_id: '/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/backendAddressPools/<Backend Address Pool Name>',
|
108
|
+
backend_http_settings_id: '/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/backendHttpSettingsCollection/<Gateway Settings Name>',
|
108
109
|
url_path_map: ''
|
109
110
|
}
|
110
|
-
]
|
111
|
-
|
111
|
+
],
|
112
|
+
tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' } # [Optional]
|
113
|
+
)
|
112
114
|
```
|
113
115
|
|
114
116
|
There can be two ways of giving `frontend_ip_configurations` while creating application gateway
|
115
117
|
|
116
|
-
1. When giving public
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
118
|
+
1. When giving public IP, then we need to provide `public_ip_address_id` as follows
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
frontend_ip_configurations:
|
122
|
+
[
|
123
|
+
{
|
124
|
+
name: '<Frontend IP Config Name>',
|
125
|
+
private_ip_allocation_method: '<IP Allocation Method>',
|
126
|
+
public_ip_address_id: '/subscriptions/<Subscription Id>/resourcegroups/<Resource Group Name>/providers/Microsoft.Network/publicIPAddresses/<Public IP Address Name>',
|
127
|
+
private_ip_address: '<IP Address>'
|
128
|
+
}
|
129
|
+
]
|
128
130
|
2. When giving subnet id, then we need to provide `subnet_id` as follows
|
129
131
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
132
|
+
```ruby
|
133
|
+
frontend_ip_configurations:
|
134
|
+
[
|
135
|
+
{
|
136
|
+
name: '<Frontend IP Config Name>',
|
137
|
+
private_ip_allocation_method: '<IP Allocation Method>',
|
138
|
+
subnet_id: '<Subnet ID>',
|
139
|
+
private_ip_address: '<IP Address>'
|
140
|
+
}
|
141
|
+
]
|
141
142
|
## List Application Gateways
|
142
143
|
|
143
144
|
List all application gateways in a resource group
|
144
145
|
|
145
146
|
```ruby
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
147
|
+
gateways = fog_application_gateway_service.gateways(resource_group: '<Resource Group Name>')
|
148
|
+
gateways.each do |gateway|
|
149
|
+
puts "#{gateway.name}"
|
150
|
+
end
|
150
151
|
```
|
151
152
|
|
152
153
|
## Retrieve a single Application Gateway
|
@@ -154,79 +155,81 @@ List all application gateways in a resource group
|
|
154
155
|
Get a single record of Application Gateway
|
155
156
|
|
156
157
|
```ruby
|
157
|
-
|
158
|
+
gateway = fog_application_gateway_service
|
158
159
|
.gateways
|
159
|
-
.get('<Resource Group
|
160
|
-
|
160
|
+
.get('<Resource Group Name>', '<Application Gateway Name>')
|
161
|
+
puts "#{gateway.name}"
|
161
162
|
```
|
162
163
|
|
163
164
|
|
164
|
-
## Update
|
165
|
+
## Update SKU attributes (Name and Capacity)
|
165
166
|
|
166
167
|
```ruby
|
167
|
-
|
168
|
+
ag.update_sku('<SKU Name>', '<SKU Capacity>')
|
168
169
|
```
|
169
170
|
|
170
|
-
## Update gateway
|
171
|
+
## Update gateway IP configuration (Subnet Id)
|
172
|
+
|
171
173
|
|
172
174
|
```ruby
|
173
|
-
|
175
|
+
ag.update_gateway_ip_configuration('/subscriptions/<Subscription Id>/<Resource Group Name>/<Gateway Name>/providers/Microsoft.Network/virtualNetworks/<Virtual Network Name>/subnets/<Subnet Name>')
|
174
176
|
```
|
175
177
|
|
176
|
-
## Add/Remove SSL Certificates
|
178
|
+
## Add/ Remove SSL Certificates
|
177
179
|
|
178
180
|
```ruby
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
181
|
+
ag.add_ssl_certificate(
|
182
|
+
{
|
183
|
+
name: '<SSL Certificate Name>',
|
184
|
+
data: '<SSL Certificate Data>',
|
185
|
+
password: '<Password>',
|
186
|
+
public_cert_data: '<Public Certificate Data>'
|
187
|
+
}
|
188
|
+
)
|
187
189
|
|
188
|
-
|
189
|
-
|
190
|
-
name: '<SSL Certificate
|
191
|
-
data: '
|
192
|
-
password: '
|
193
|
-
public_cert_data: '
|
194
|
-
|
195
|
-
|
190
|
+
ag.remove_ssl_certificate(
|
191
|
+
{
|
192
|
+
name: '<SSL Certificate Name>',
|
193
|
+
data: '<SSL Certificate Data>',
|
194
|
+
password: '<Password>',
|
195
|
+
public_cert_data: '<Public Certificate Data>'
|
196
|
+
}
|
197
|
+
)
|
196
198
|
```
|
197
199
|
|
198
|
-
## Add/Remove Frontend ports
|
200
|
+
## Add/ Remove Frontend ports
|
199
201
|
|
200
202
|
```ruby
|
201
|
-
|
203
|
+
ag.add_frontend_port({name: '<Frontend Port Name>', port: <Port Number>})
|
202
204
|
|
203
|
-
|
205
|
+
ag.remove_frontend_port({name: '<Frontend Port Name>', port: <Port Number>})
|
204
206
|
```
|
205
207
|
|
206
|
-
## Add/Remove Probes
|
208
|
+
## Add/ Remove Probes
|
207
209
|
|
208
210
|
```ruby
|
209
|
-
|
211
|
+
ag.add_probe(
|
210
212
|
{
|
211
|
-
name: '<Probe
|
212
|
-
protocol: '
|
213
|
-
host: '
|
214
|
-
path: '
|
215
|
-
interval:
|
216
|
-
timeout:
|
217
|
-
unhealthy_threshold:
|
218
|
-
|
219
|
-
|
220
|
-
|
213
|
+
name: '<Probe Name>',
|
214
|
+
protocol: '<Protocol Name>',
|
215
|
+
host: '<Host Name>',
|
216
|
+
path: '<Probe Path>',
|
217
|
+
interval: <Interval Time>,
|
218
|
+
timeout: <Timeout Time>,
|
219
|
+
unhealthy_threshold: <Threshold Value>
|
220
|
+
}
|
221
|
+
)
|
222
|
+
|
223
|
+
ag.remove__probe(
|
221
224
|
{
|
222
225
|
name: '<Probe name>',
|
223
|
-
protocol: '
|
224
|
-
host: '
|
225
|
-
path: '
|
226
|
-
interval:
|
227
|
-
timeout:
|
228
|
-
unhealthy_threshold:
|
229
|
-
|
226
|
+
protocol: '<Protocol Name>',
|
227
|
+
host: '<Protocol Name>',
|
228
|
+
path: '<Probe Path>',
|
229
|
+
interval: <Interval Time>,
|
230
|
+
timeout: <Timeout Time>,
|
231
|
+
unhealthy_threshold: <Threshold Value>
|
232
|
+
}
|
230
233
|
)
|
231
234
|
```
|
232
235
|
|
@@ -235,8 +238,8 @@ Get a single record of Application Gateway
|
|
235
238
|
Get a application gateway object from the get method and then destroy that application gateway.
|
236
239
|
|
237
240
|
```ruby
|
238
|
-
|
241
|
+
gateway.destroy
|
239
242
|
```
|
240
243
|
|
241
244
|
## Support and Feedback
|
242
|
-
Your feedback is highly appreciated! If you have specific issues with the
|
245
|
+
Your feedback is highly appreciated! If you have specific issues with the Fog ARM, you should file an issue via Github.
|
@@ -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,78 +15,81 @@ require 'fog/azurerm'
|
|
15
15
|
Next, create a connection to the Compute Service:
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
|
19
|
-
tenant_id: '<
|
20
|
-
client_id: '<
|
21
|
-
client_secret: '<
|
22
|
-
subscription_id: '<
|
23
|
-
environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>'
|
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.
|
24
24
|
)
|
25
25
|
```
|
26
26
|
|
27
27
|
## Check Server Existence
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
|
30
|
+
fog_compute_service.servers.check_vm_exists('<Resource Group Name>', '<VM Name>')
|
31
31
|
```
|
32
32
|
|
33
33
|
## Create Server
|
34
34
|
|
35
35
|
**Info:**
|
36
36
|
|
37
|
-
- Attribute **network_interface_card_ids** is an array of NICs
|
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
38
|
- To create VM with managed OS disk, use the _managed_disk_storage_type_ argument
|
39
39
|
- To create VM with unmanaged OS disk, use the _storage_account_name_ argument
|
40
40
|
|
41
|
+
|
41
42
|
### Virtual Machine (Managed OS Disk)
|
42
43
|
|
43
44
|
```ruby
|
44
|
-
|
45
|
+
fog_compute_service.servers.create(
|
45
46
|
name: '<VM Name>',
|
46
|
-
location: '
|
47
|
+
location: '<Location>',
|
47
48
|
resource_group: '<Resource Group Name>',
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
disable_password_authentication:
|
52
|
-
network_interface_card_ids: ['/subscriptions
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
49
|
+
tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' },
|
50
|
+
vm_size: '<Virtual Machine Size>',
|
51
|
+
username: '<Username>',
|
52
|
+
disable_password_authentication: <True/False>,
|
53
|
+
network_interface_card_ids: ['/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/networkInterfaces/<Network Interface Id>'],
|
54
|
+
publisher: '<Publisher Name>', # Not required if custom image is being used
|
55
|
+
offer: '<Offer Name>', # Not required if custom image is being used
|
56
|
+
sku: '<SKU Name>', # Not required if custom image is being used
|
57
|
+
version: '<Version>', # Not required if custom image is being used
|
58
|
+
platform: '<OS Type>',
|
59
|
+
availability_set_id: '<Availability Set Id>', # [Optional]
|
60
|
+
password: '<Password>', # [Optional], if 'platform' partameter is 'Linux'.
|
61
|
+
vhd_path: '<Path of VHD>', # [Optional], if you want to create the VM from a custom image.
|
62
|
+
custom_data: '<Custom Data Value>', # [Optional], if you want to add custom data in this VM.
|
63
|
+
os_disk_caching: '<Caching Type>', # [Optional], can be one of None, ReadOnly, ReadWrite
|
64
|
+
managed_disk_storage_type: '<Storage Account Type>', # [Optional], if storage_account_name is passed, can be StandardLRS or PremiumLRS
|
65
|
+
os_disk_size: <Disk Size> # [Optional], size of the os disk in GB (upto 1023)
|
66
|
+
)
|
65
67
|
```
|
66
68
|
|
67
69
|
### Virtual Machine (Unmanaged OS Disk)
|
68
70
|
|
69
71
|
```ruby
|
70
|
-
|
72
|
+
fog_compute_service.servers.create(
|
71
73
|
name: '<VM Name>',
|
72
|
-
location: '
|
74
|
+
location: '<Location>',
|
73
75
|
resource_group: '<Resource Group Name>',
|
74
|
-
|
76
|
+
tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' },
|
77
|
+
vm_size: '<Virtual Machine Size>',
|
75
78
|
storage_account_name: '<Storage Account Name>',
|
76
|
-
username: '<Username
|
77
|
-
password: '<Password
|
78
|
-
disable_password_authentication:
|
79
|
-
network_interface_card_ids: ['/subscriptions
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
vhd_path: '<Path of VHD>',
|
87
|
-
custom_data: '
|
88
|
-
os_disk_size: <Disk Size>
|
89
|
-
|
79
|
+
username: '<Username>',
|
80
|
+
password: '<Password>',
|
81
|
+
disable_password_authentication: <True/False>,
|
82
|
+
network_interface_card_ids: ['/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/networkInterfaces/<Network Interface Id>'],
|
83
|
+
publisher: '<Publisher Name>', # Not required if custom image is being used
|
84
|
+
offer: '<Offer Name>', # Not required if custom image is being used
|
85
|
+
sku: '<SKU Name>', # Not required if custom image is being used
|
86
|
+
version: '<Version>', # Not required if custom image is being used
|
87
|
+
platform: '<OS Type>',
|
88
|
+
availability_set_id: '<Availability Set Id>', # [Optional]
|
89
|
+
vhd_path: '<Path of VHD>', # [Optional], if you want to create the VM from a custom image.
|
90
|
+
custom_data: '<Custom Data Value>', # [Optional], if you want to add custom data in this VM.
|
91
|
+
os_disk_size: <Disk Size> # [Optional], size of the os disk in GB (upto 1023)
|
92
|
+
)
|
90
93
|
```
|
91
94
|
|
92
95
|
## Create Server Asynchronously
|
@@ -94,28 +97,29 @@ azure_compute_service.servers.check_vm_exists(<Resource Group name>, <VM Name>)
|
|
94
97
|
Create a new linux server asynchronously
|
95
98
|
|
96
99
|
```ruby
|
97
|
-
|
100
|
+
async_response = fog_compute_service.servers.create_async(
|
98
101
|
name: '<VM Name>',
|
99
|
-
location: '
|
102
|
+
location: '<Location>',
|
100
103
|
resource_group: '<Resource Group Name>',
|
101
|
-
|
104
|
+
tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' },
|
105
|
+
vm_size: '<Virtual Machine Size>',
|
102
106
|
storage_account_name: '<Storage Account Name>',
|
103
107
|
username: '<Username for VM>',
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
vhd_path: '<Path of VHD>',
|
114
|
-
custom_data: '
|
115
|
-
os_disk_caching:
|
116
|
-
managed_disk_storage_type:
|
117
|
-
os_disk_size: <Disk Size>
|
118
|
-
|
108
|
+
disable_password_authentication: <True/False>,
|
109
|
+
network_interface_card_ids: ['/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/networkInterfaces/<Network Interface Id>'],
|
110
|
+
publisher: '<Publisher Name>', # Not required if custom image is being used
|
111
|
+
offer: '<Offer Name>', # Not required if custom image is being used
|
112
|
+
sku: '<SKU Name>', # Not required if custom image is being used
|
113
|
+
version: '<Version>' , # Not required if custom image is being used
|
114
|
+
platform: '<OS Type>',
|
115
|
+
availability_set_id: '<Availability Set Id>', # [Optional]
|
116
|
+
password: '<Password>', # [Optional], if 'platform' partameter is 'Linux'.
|
117
|
+
vhd_path: '<Path of VHD>', # [Optional], if you want to create the VM from a custom image.
|
118
|
+
custom_data: '<Custom Data Value>', # [Optional], if you want to add custom data in this VM.
|
119
|
+
os_disk_caching: '<Caching Type>', # [Optional], can be one of None, ReadOnly, ReadWrite
|
120
|
+
managed_disk_storage_type: '<Storage Account Type>', # [Optional], can be StandardLRS or PremiumLRS
|
121
|
+
os_disk_size: <Disk Size> # [Optional], size of the os disk in GB (upto 1023)
|
122
|
+
)
|
119
123
|
```
|
120
124
|
Following methods are available to handle async respoonse:
|
121
125
|
- state
|
@@ -147,18 +151,18 @@ while 1
|
|
147
151
|
end
|
148
152
|
```
|
149
153
|
|
150
|
-
For more information about custom_data
|
154
|
+
For more information about custom_data, see link: https://msdn.microsoft.com/en-us/library/azure/mt163591.aspx
|
151
155
|
|
152
156
|
## List Servers
|
153
157
|
|
154
158
|
List servers in a resource group
|
155
159
|
|
156
160
|
```ruby
|
157
|
-
|
158
|
-
|
161
|
+
servers = fog_compute_service.servers(resource_group: '<Resource Group Name>')
|
162
|
+
servers.each do |server|
|
159
163
|
puts "#{server.name}"
|
160
164
|
puts "#{server.location}"
|
161
|
-
|
165
|
+
end
|
162
166
|
```
|
163
167
|
|
164
168
|
## Retrieve a single Server
|
@@ -166,272 +170,270 @@ List servers in a resource group
|
|
166
170
|
Get a single record of Server
|
167
171
|
|
168
172
|
```ruby
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
+
server = fog_compute_service
|
174
|
+
.servers(resource_group: '<Resource Group Name>')
|
175
|
+
.get('<Resource Group Name>', 'Server Name>')
|
176
|
+
puts "#{server.name}"
|
173
177
|
```
|
174
178
|
|
175
|
-
##
|
179
|
+
## Get a Server's status
|
176
180
|
|
177
|
-
|
181
|
+
Check the status of a Server
|
178
182
|
|
179
|
-
```ruby
|
180
|
-
|
183
|
+
```ruby
|
184
|
+
status = fog_compute_service
|
185
|
+
.servers
|
186
|
+
.get('<Resource Group Name>', '<Server Name>')
|
187
|
+
.vm_status
|
188
|
+
puts status
|
181
189
|
```
|
182
190
|
|
183
|
-
##
|
191
|
+
## Destroy a single Server
|
184
192
|
|
185
|
-
Get
|
193
|
+
Get a server object from the get method (described above) and then destroy that server.
|
186
194
|
|
187
195
|
```ruby
|
188
|
-
|
196
|
+
server.destroy
|
189
197
|
```
|
190
198
|
|
191
|
-
## Attach a
|
199
|
+
## Attach a Data Disk to Server
|
192
200
|
|
193
|
-
Get the server object and attach a Data Disk to it.
|
201
|
+
Get the server object and attach a Data Disk to it. The data disk attached is blob based.
|
194
202
|
|
195
203
|
```ruby
|
196
|
-
|
204
|
+
server.attach_data_disk('<Disk Name>', <Size in GBs>, '<Storage Account Name>')
|
197
205
|
```
|
198
206
|
|
199
|
-
## Detach a
|
207
|
+
## Detach a Data Disk from Server
|
200
208
|
|
201
209
|
Get the server object and detach a Data Disk from it.
|
202
210
|
|
203
211
|
```ruby
|
204
|
-
|
212
|
+
server.detach_data_disk('<Disk Name>')
|
205
213
|
```
|
206
214
|
|
207
|
-
##
|
215
|
+
## Create Managed Disk
|
208
216
|
|
209
|
-
|
217
|
+
Create a new Premium Managed Disk
|
210
218
|
|
211
|
-
```ruby
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
219
|
+
```ruby
|
220
|
+
fog_compute_service.managed_disks.create(
|
221
|
+
name: '<Disk Name>',
|
222
|
+
location: '<Location>',
|
223
|
+
resource_group_name: '<Resource Group Name>',
|
224
|
+
account_type: '<Storage Account Type>',
|
225
|
+
disk_size_gb: <Disk Size in GBs>,
|
226
|
+
creation_data: {
|
227
|
+
create_option: '<Create Option Value>'
|
228
|
+
}
|
229
|
+
)
|
217
230
|
```
|
218
231
|
|
219
|
-
|
220
|
-
|
221
|
-
Get a server object from the get method(described above) and then destroy that server.
|
232
|
+
Create a new Standard Managed Disk
|
222
233
|
|
223
234
|
```ruby
|
224
|
-
|
235
|
+
fog_compute_service.managed_disks.create(
|
236
|
+
name: '<Disk Name>',
|
237
|
+
location: '<Location>',
|
238
|
+
resource_group_name: '<Resource Group Name>',
|
239
|
+
account_type: '<Storage Account Type>',
|
240
|
+
disk_size_gb: <Disk Size in GBs>,
|
241
|
+
creation_data: {
|
242
|
+
create_option: '<Create Option Value>'
|
243
|
+
}
|
244
|
+
)
|
225
245
|
```
|
226
246
|
|
227
|
-
##
|
247
|
+
## Attach a Managed Data Disk to Server
|
248
|
+
|
249
|
+
Get the server object and attach a Data Disk to it.
|
228
250
|
|
229
251
|
```ruby
|
230
|
-
|
252
|
+
server.attach_managed_disk('<Disk Name>', '<Disk Resource Group Name>')
|
231
253
|
```
|
232
254
|
|
233
|
-
##
|
255
|
+
## Detach a Managed Data Disk from Server
|
234
256
|
|
235
|
-
|
257
|
+
Get the server object and detach a Data Disk from it.
|
236
258
|
|
237
259
|
```ruby
|
238
|
-
|
239
|
-
name: '<Availability Set name>',
|
240
|
-
location: '<Location>',
|
241
|
-
resource_group: '<Resource Group name>'
|
242
|
-
platform_fault_domain_count: <No of Fault Domains>, # [Optional] Default => 2
|
243
|
-
platform_update_domain_count: <No of Update Domains>, # [Optional] Default => 5
|
244
|
-
use_managed_disk: true # [Optional] Possible values true or false
|
245
|
-
)
|
260
|
+
server.detach_managed_disk('<Disk Name>')
|
246
261
|
```
|
247
|
-
## List Availability Sets
|
248
262
|
|
249
|
-
List
|
263
|
+
## List Managed Disks in a Resource Group
|
264
|
+
|
265
|
+
List managed disks in a resource group
|
250
266
|
|
251
267
|
```ruby
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
268
|
+
managed_disks = fog_compute_service.managed_disks(resource_group: '<Resource Group Name>')
|
269
|
+
mnaged_disks.each do |disk|
|
270
|
+
puts "#{disk.name}"
|
271
|
+
puts "#{disk.location}"
|
272
|
+
end
|
257
273
|
```
|
258
274
|
|
259
|
-
##
|
275
|
+
## List Managed Disks in a Subscription
|
260
276
|
|
261
|
-
|
277
|
+
List managed disks in a subscription
|
262
278
|
|
263
279
|
```ruby
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
280
|
+
fog_compute_service.managed_disks.each do |disk|
|
281
|
+
puts "#{disk.name}"
|
282
|
+
puts "#{disk.location}"
|
283
|
+
end
|
268
284
|
```
|
269
285
|
|
270
|
-
##
|
286
|
+
## Grant Access to a Managed Disk
|
271
287
|
|
272
|
-
|
288
|
+
Grant access to a managed disk
|
273
289
|
|
274
290
|
```ruby
|
275
|
-
|
291
|
+
access_sas = fog_compute_service.managed_disks.grant_access('<Resource Group Name>', '<Disk Name>', '<Access Type>', <Duration in Seconds>)
|
292
|
+
puts "Access SAS: #{access_sas}"
|
276
293
|
```
|
277
294
|
|
278
|
-
##
|
295
|
+
## Revoke Access from a Managed Disk
|
296
|
+
|
297
|
+
Revoke access from a managed disk
|
279
298
|
|
280
299
|
```ruby
|
281
|
-
|
300
|
+
response = fog_compute_service.managed_disks.revoke_access('<Resource Group Name>', '<Disk Name>')
|
301
|
+
puts "Revoke Access response status: #{response.status}"
|
282
302
|
```
|
283
303
|
|
284
|
-
##
|
285
|
-
|
286
|
-
Installs an extension to the specified virtual machine.
|
304
|
+
## Check Managed Disk Existence
|
287
305
|
|
288
306
|
```ruby
|
289
|
-
|
290
|
-
name: <Extension Name>,
|
291
|
-
resource_group: <Resource Group>,
|
292
|
-
location: <Location>,
|
293
|
-
vm_name: <Virtual Machine Name>, # Extension will be installed on this VM
|
294
|
-
publisher: <Extension publisher>,
|
295
|
-
type: <Extension type>,
|
296
|
-
type_handler_version: <Extension version>,
|
297
|
-
auto_upgrade_minor_version: <true|false>, # Optional
|
298
|
-
settings: {JSON object}, # Format: {"key": "value", "key": {"key": "value"}}
|
299
|
-
protected_settings: {JSON object}
|
300
|
-
)
|
307
|
+
fog_compute_service.managed_disks.check_managed_disk_exists('<Resource Group Name>', '<Disk Name>')
|
301
308
|
```
|
302
309
|
|
303
|
-
##
|
310
|
+
## Retrieve a single Managed Disk
|
304
311
|
|
305
|
-
|
312
|
+
Get a single record of managed disks
|
306
313
|
|
307
314
|
```ruby
|
308
|
-
|
309
|
-
|
310
|
-
|
315
|
+
managed_disk = fog_compute_service
|
316
|
+
.managed_disks
|
317
|
+
.get('<Resource Group Name>', '<Disk Name>')
|
318
|
+
puts "#{managed_disk.name}"
|
311
319
|
```
|
312
320
|
|
313
|
-
##
|
321
|
+
## Destroy a single Managed Disk
|
314
322
|
|
315
|
-
|
316
|
-
- auto_upgrade_minor_version
|
317
|
-
- settings
|
318
|
-
- protected_settings
|
323
|
+
Get an managed disk object from the get method and then destroy that managed disk.
|
319
324
|
|
320
325
|
```ruby
|
321
|
-
|
322
|
-
auto_upgrade_minor_version: <true|false>,
|
323
|
-
settings: {JSON object},
|
324
|
-
protected_settings: {JSON object}
|
325
|
-
)
|
326
|
+
managed_disk.destroy
|
326
327
|
```
|
327
328
|
|
328
|
-
##
|
329
|
-
|
330
|
-
Destroy the given extension from the virtual machine
|
329
|
+
## Check Availability Set Existence
|
331
330
|
|
332
331
|
```ruby
|
333
|
-
|
332
|
+
fog_compute_service.availability_sets.check_availability_set_exists('<Resource Group Name>', '<Availability Set Name>')
|
334
333
|
```
|
335
334
|
|
335
|
+
## Create Availability Set
|
336
336
|
|
337
|
-
|
338
|
-
|
339
|
-
Create a new Premium Managed Disk
|
337
|
+
Create a new availability set
|
340
338
|
|
341
339
|
```ruby
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
}
|
351
|
-
)
|
340
|
+
fog_compute_service.availability_sets.create(
|
341
|
+
name: '<Availability Set Name>',
|
342
|
+
location: '<Location>',
|
343
|
+
resource_group: '<Resource Group Name>'
|
344
|
+
platform_fault_domain_count: <No of Fault Domains>, # [Optional] Default => 2
|
345
|
+
platform_update_domain_count: <No of Update Domains>, # [Optional] Default => 5
|
346
|
+
use_managed_disk: true # [Optional] Possible values true or false
|
347
|
+
)
|
352
348
|
```
|
349
|
+
## List Availability Sets
|
353
350
|
|
354
|
-
|
351
|
+
List availability sets in a resource group
|
355
352
|
|
356
353
|
```ruby
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
disk_size_gb: 1023,
|
363
|
-
creation_data: {
|
364
|
-
create_option: 'Empty'
|
365
|
-
}
|
366
|
-
)
|
354
|
+
availability_sets = fog_compute_service.availability_sets(resource_group: '<Resource Group Name>')
|
355
|
+
availability_sets.each do |availability_set|
|
356
|
+
puts "#{availability_set.name}"
|
357
|
+
puts "#{availability_set.location}"
|
358
|
+
end
|
367
359
|
```
|
368
360
|
|
369
|
-
##
|
361
|
+
## Retrieve a single Availability Set
|
370
362
|
|
371
|
-
|
363
|
+
Get a single record of Availability Set
|
372
364
|
|
373
365
|
```ruby
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
end
|
366
|
+
availability_set = fog_compute_service
|
367
|
+
.availability_sets
|
368
|
+
.get('<Resource Group Name>','<Availability Set Name>')
|
369
|
+
puts "#{availability_set.name}"
|
379
370
|
```
|
380
371
|
|
381
|
-
##
|
372
|
+
## Destroy a single Availability Set
|
382
373
|
|
383
|
-
|
374
|
+
Get an availability set object from the get method and then destroy that availability set.
|
384
375
|
|
385
376
|
```ruby
|
386
|
-
|
387
|
-
puts "#{disk.name}"
|
388
|
-
puts "#{disk.location}"
|
389
|
-
end
|
377
|
+
availability_set.destroy
|
390
378
|
```
|
391
379
|
|
392
|
-
##
|
393
|
-
|
394
|
-
Grant access to a managed disk
|
380
|
+
## Check Virtual Machine Extension Existence
|
395
381
|
|
396
382
|
```ruby
|
397
|
-
|
398
|
-
puts "Access SAS: #{access_sas}"
|
383
|
+
fog_compute_service.virtual_machine_extensions.check_vm_extension_exists('<Resource Group Name>', '<Virtual Machine Name>', '<Extension Name>')
|
399
384
|
```
|
400
385
|
|
401
|
-
##
|
386
|
+
## Create Virtual Machine Extension
|
402
387
|
|
403
|
-
|
388
|
+
Installs an extension to the specified virtual machine.
|
404
389
|
|
405
390
|
```ruby
|
406
|
-
|
407
|
-
|
391
|
+
fog_compute_service.virtual_machine_extensions.create(
|
392
|
+
name: '<Extension Name>',
|
393
|
+
resource_group: '<Resource Group Name>',
|
394
|
+
location: '<Location>',
|
395
|
+
vm_name: '<Virtual Machine Name>', # Extension will be installed on this VM
|
396
|
+
publisher: '<Extension Publisher>',
|
397
|
+
type: '<Extension Type>',
|
398
|
+
type_handler_version: '<Extension Version>',
|
399
|
+
settings: {JSON object}, # Format: {"key": "value", "key": {"key": "value"}}
|
400
|
+
protected_settings: {JSON object},
|
401
|
+
auto_upgrade_minor_version: <True/False> , # Optional
|
402
|
+
)
|
408
403
|
```
|
409
404
|
|
410
|
-
##
|
405
|
+
## Get Extension from Virtual Machine
|
406
|
+
|
407
|
+
Retrieves the given extension from the virtual machine
|
411
408
|
|
412
409
|
```ruby
|
413
|
-
|
410
|
+
vm_extension = fog_compute_service.virtual_machine_extensions.get(
|
411
|
+
'<Resource Group Name>', '<Virtual Machine Name>', '<Extension Name>'
|
412
|
+
)
|
414
413
|
```
|
415
414
|
|
416
|
-
##
|
415
|
+
## Update Extension
|
417
416
|
|
418
|
-
|
417
|
+
Update the given extension. The attributes that can be modified are
|
418
|
+
- auto_upgrade_minor_version
|
419
|
+
- settings
|
420
|
+
- protected_settings
|
419
421
|
|
420
422
|
```ruby
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
423
|
+
vm_extension.update(
|
424
|
+
auto_upgrade_minor_version: <True/False>,
|
425
|
+
settings: {JSON object},
|
426
|
+
protected_settings: {JSON object}
|
427
|
+
)
|
425
428
|
```
|
426
429
|
|
427
|
-
## Destroy
|
430
|
+
## Destroy Extension
|
428
431
|
|
429
|
-
|
432
|
+
Destroy the given extension from the virtual machine
|
430
433
|
|
431
434
|
```ruby
|
432
|
-
|
435
|
+
vm_extension.destroy
|
433
436
|
```
|
434
437
|
|
435
|
-
|
436
438
|
## Support and Feedback
|
437
439
|
Your feedback is appreciated! If you have specific issues with the fog ARM, you should file an issue via Github.
|