fog-azure-rm 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 13f17ed03ff7536e9b9d9b71bb865dc543b59e1b
4
- data.tar.gz: 963f1baac6eedbe81e483f495dcbd46eb64af2ff
2
+ SHA256:
3
+ metadata.gz: 34ee4dc155b1227329c3833c1bf6c3a0603f6f91ffaf06702a82c649b5588c7b
4
+ data.tar.gz: cea157198db03ed7f9aba2af3ef1cea364db7b1109d3d98aa9c937af76fb8e95
5
5
  SHA512:
6
- metadata.gz: db73728f0b7b18d6299fb323764ab33366094142bf878b90cd569664313a906b059675dba5ade8a4fb31b0bcf071400357e72bbc956e15e4f497dd4b701636b4
7
- data.tar.gz: dbce127ba78e5657f9f6d5ef0ff3ce312f82a2bb21a35a8489eb0caf10c63edb5e5c13b51702a0398b919123024f27669fa6e05b16503223094496b66197a016
6
+ metadata.gz: 85c0c89befd15482cc097393860ded6df9b49b764e3f9cc5047b4c84f33d2c743eed347c81ba12566c11cc50900a4532f66cc60f86a81b3c7edf595cb4c4fd3c
7
+ data.tar.gz: b5a0704f2f32bc8f8d1cd4ad51384b4d10aedabc10a67dc6a90c747a4ede66870fa3f55b88c951f59cd5bbc5c7558704a2d738ec6fa7e34be71f0b005a1a7187
data/.travis.yml CHANGED
@@ -4,8 +4,9 @@ sudo: false
4
4
  before_install:
5
5
  - gem install bundler
6
6
  - gem update bundler
7
+ - gem uninstall -aIx nokogiri -i /home/travis/.rvm/gems/ruby-2.4.1@global nokogiri
7
8
 
8
- script: sh rake-script.sh
9
+ script: bash ./rake-script.sh
9
10
 
10
11
  matrix:
11
12
  fast_finish: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.3.8
2
+
3
+ **Changed:**
4
+ - Updated documentation
5
+
6
+ **Fixed:**
7
+ - Compute Service - Fixed issue with fault/update domain not populating
8
+
1
9
  ## 0.3.7
2
10
 
3
11
  **Fixed:**
@@ -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/update/list/delete Application Gateway.
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
- azure_application_gateway_service = Fog::ApplicationGateway::AzureRM.new(
18
- tenant_id: '<TenantId>', # Tenant id of Azure Active Directory Application
19
- client_id: '<ClientId>', # Client id of Azure Active Directory Application
20
- client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
21
- subscription_id: '<SubscriptionId>', # Subscription id of an Azure Account
22
- environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
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
- azure_application_gateway_service.gateways.check_application_gateway_exists(<Resource Group name>, <Gateway Name>)
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
- gateway = azure_application_gateway_service.gateways.create(
38
+ gateway = fog_application_gateway_service.gateways.create(
39
+
38
40
  name: '<Gateway Name>',
39
- location: 'eastus',
41
+ location: '<Location>',
40
42
  resource_group: '<Resource Group name>',
41
- tags: { key1: "value1", key2: "value2", keyN: "valueN" }, # [Optional]
42
- sku_name: 'Standard_Medium',
43
- sku_tier: 'Standard',
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: 'gatewayIpConfigName',
49
- subnet_id: '/subscriptions/<Subscription_id>/resourcegroups/<Resource Group name>/providers/Microsoft.Network/virtualNetworks/<Virtual Network Name>/subnets/<Subnet Name>'
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: 'frontendIpConfig',
56
- private_ip_allocation_method: Fog::ARM::Network::Models::IPAllocationMethod::Dynamic,
57
- public_ip_address_id: '/subscriptions/<Subscription_id>/resourcegroups/<Resource Group name>/providers/Microsoft.Network/publicIPAddresses/<Public IP Address Name>',
58
- private_ip_address: '10.0.1.5'
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: 'frontendPort',
65
- port: 443
65
+ name: '<Frontend Port Name>',
66
+ port: <Port Number>
66
67
  }
67
68
  ],
68
69
  backend_address_pools:
69
70
  [
70
71
  {
71
- name: 'backendAddressPool',
72
+ name: '<Backend Address Pool Name>',
72
73
  ip_addresses: [
73
74
  {
74
- ipAddress: '10.0.1.6'
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: 'gateway_settings',
83
- port: 80,
84
- protocol: 'Http',
85
- cookie_based_affinity: 'Enabled',
86
- request_timeout: '30'
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: 'gateway_listener',
93
- frontend_ip_config_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/frontendIPConfigurations/frontendIpConfig',
94
- frontend_port_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/frontendPorts/frontendPort',
95
- protocol: 'Http',
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: 'false'
98
+ require_server_name_indication: '<True/False>'
98
99
  }
99
100
  ],
100
101
  request_routing_rules:
101
102
  [
102
103
  {
103
- name: 'gateway_request_route_rule',
104
- type: 'Basic',
105
- http_listener_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/httpListeners/gateway_listener',
106
- backend_address_pool_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/backendAddressPools/backendAddressPool',
107
- backend_http_settings_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/backendHttpSettingsCollection/gateway_settings',
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 ip, then we need to provide `public_ip_address_id` as follows
117
-
118
- `frontend_ip_configurations:
119
- [
120
- {
121
- name: 'frontendIpConfig',
122
- private_ip_allocation_method: Fog::ARM::Network::Models::IPAllocationMethod::Dynamic,
123
- public_ip_address_id: '/subscriptions/<Subscription_id>/resourcegroups/<Resource Group name>/providers/Microsoft.Network/publicIPAddresses/<Public IP Address Name>',
124
- private_ip_address: '10.0.1.5'
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
- `frontend_ip_configurations:
131
- [
132
- {
133
- name: 'frontendIpConfig',
134
- private_ip_allocation_method: Fog::ARM::Network::Models::IPAllocationMethod::Dynamic,
135
- subnet_id: '<Subnet ID',
136
- private_ip_address: '10.0.1.5'
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
- gateways = azure_application_gateway_service.gateways(resource_group: '<Resource Group Name>')
147
- gateways.each do |gateway|
148
- puts "#{gateway.name}"
149
- end
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
- gateway = azure_application_gateway_service
158
+ gateway = fog_application_gateway_service
158
159
  .gateways
159
- .get('<Resource Group name>', '<Application Gateway Name>')
160
- puts "#{gateway.name}"
160
+ .get('<Resource Group Name>', '<Application Gateway Name>')
161
+ puts "#{gateway.name}"
161
162
  ```
162
163
 
163
164
 
164
- ## Update sku attributes (Name and Capacity)
165
+ ## Update SKU attributes (Name and Capacity)
165
166
 
166
167
  ```ruby
167
- ag.update_sku('Standard_Small', '1')
168
+ ag.update_sku('<SKU Name>', '<SKU Capacity>')
168
169
  ```
169
170
 
170
- ## Update gateway ip configuration (Subnet id)
171
+ ## Update gateway IP configuration (Subnet Id)
172
+
171
173
 
172
174
  ```ruby
173
- ag.update_gateway_ip_configuration("/subscriptions/<Subscription_id>/<Resource Group name>/<Gateway Name>/providers/Microsoft.Network/virtualNetworks/<Virtual Network Name>/subnets/<Subnet Name>")
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
- ag.add_ssl_certificate(
180
- {
181
- name: '<SSL Certificate name>',
182
- data: 'Base-64 encoded pfx certificate',
183
- password: 'azure',
184
- public_cert_data: 'Base-64 encoded Public cert data corresponding to pfx specified in data.'
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
- ag.remove_ssl_certificate(
189
- {
190
- name: '<SSL Certificate name>',
191
- data: 'Base-64 encoded pfx certificate',
192
- password: 'azure',
193
- public_cert_data: 'Base-64 encoded Public cert data corresponding to pfx specified in 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
- ag.add_frontend_port({name: '<Frontend port name>', port: 80})
203
+ ag.add_frontend_port({name: '<Frontend Port Name>', port: <Port Number>})
202
204
 
203
- ag.remove_frontend_port({name: '<Frontend port name>', port: 80})
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
- ag.add_probe(
211
+ ag.add_probe(
210
212
  {
211
- name: '<Probe name>',
212
- protocol: 'http',
213
- host: 'localhost',
214
- path: '/fog-test',
215
- interval: 60,
216
- timeout: 300,
217
- unhealthy_threshold: 5
218
- }
219
- )
220
- ag.remove__probe(
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: 'http',
224
- host: 'localhost',
225
- path: '/fog-test',
226
- interval: 60,
227
- timeout: 300,
228
- unhealthy_threshold: 5
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
- gateway.destroy
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 fog ARM, you should file an issue via Github.
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/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,78 +15,81 @@ require 'fog/azurerm'
15
15
  Next, create a connection to the Compute Service:
16
16
 
17
17
  ```ruby
18
- azure_compute_service = Fog::Compute::AzureRM.new(
19
- tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
20
- client_id: '<Clientid>', # Client id of Azure Active Directory Application
21
- client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
22
- subscription_id: '<Subscriptionid>', # Subscription id of an Azure Account
23
- 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.
24
24
  )
25
25
  ```
26
26
 
27
27
  ## Check Server Existence
28
28
 
29
29
  ```ruby
30
- 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>')
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 ids. The NIC id at index zero will become primary NIC of this server(virtual machine) by default.
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
- azure_compute_service.servers.create(
45
+ fog_compute_service.servers.create(
45
46
  name: '<VM Name>',
46
- location: 'West US',
47
+ location: '<Location>',
47
48
  resource_group: '<Resource Group Name>',
48
- vm_size: 'Basic_A0',
49
- username: '<Username for VM>',
50
- password: '<Password for VM>', # Optional, if 'platform' partameter is 'Linux'.
51
- disable_password_authentication: false,
52
- network_interface_card_ids: ['/subscriptions/{Subscription-Id}/resourceGroups/{Resource-Group-Name}/providers/Microsoft.Network/networkInterfaces/{Network-Interface-Id}'],
53
- availability_set_id: '<availability_set_id>', # Optional
54
- publisher: 'Canonical', # Not required if custom image is being used
55
- offer: 'UbuntuServer', # Not required if custom image is being used
56
- sku: '14.04.2-LTS', # Not required if custom image is being used
57
- version: 'latest', # Not required if custom image is being used
58
- platform: 'Linux',
59
- vhd_path: '<Path of VHD>', # Optional, if you want to create the VM from a custom image.
60
- custom_data: 'echo customData', # Optional, if you want to add custom data in this VM.
61
- os_disk_caching: Fog::ARM::Compute::Models::CachingTypes::None, # Optional, can be one of None, ReadOnly, ReadWrite
62
- managed_disk_storage_type: Azure::ARM::Compute::Models::StorageAccountTypes::StandardLRS, # Optional if storage_account_name is passed, can be StandardLRS or PremiumLRS
63
- os_disk_size: <Disk Size> # Optional, size of the os disk in GB (upto 1023)
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
- azure_compute_service.servers.create(
72
+ fog_compute_service.servers.create(
71
73
  name: '<VM Name>',
72
- location: 'West US',
74
+ location: '<Location>',
73
75
  resource_group: '<Resource Group Name>',
74
- vm_size: 'Basic_A0',
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 for VM>',
77
- password: '<Password for VM>',
78
- disable_password_authentication: false,
79
- network_interface_card_ids: ['/subscriptions/{Subscription-Id}/resourceGroups/{Resource-Group-Name}/providers/Microsoft.Network/networkInterfaces/{Network-Interface-Id}'],
80
- availability_set_id: '<availability_set_id>', # Optional
81
- publisher: 'MicrosoftWindowsServerEssentials', # Not required if custom image is being used
82
- offer: 'WindowsServerEssentials', # Not required if custom image is being used
83
- sku: 'WindowsServerEssentials', # Not required if custom image is being used
84
- version: 'latest', # Not required if custom image is being used
85
- platform: 'Windows',
86
- vhd_path: '<Path of VHD>', # Optional, if you want to create the VM from a custom image.
87
- custom_data: 'echo customData', # Optional, if you want to add custom data in this VM.
88
- os_disk_size: <Disk Size> # Optional, size of the os disk in GB (upto 1023)
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
- async_response = azure_compute_service.servers.create_async(
100
+ async_response = fog_compute_service.servers.create_async(
98
101
  name: '<VM Name>',
99
- location: 'West US',
102
+ location: '<Location>',
100
103
  resource_group: '<Resource Group Name>',
101
- vm_size: 'Basic_A0',
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
- password: '<Password for VM>', # Optional, if 'platform' partameter is 'Linux'.
105
- disable_password_authentication: false,
106
- network_interface_card_ids: ['/subscriptions/{Subscription-Id}/resourceGroups/{Resource-Group-Name}/providers/Microsoft.Network/networkInterfaces/{Network-Interface-Id}'],
107
- availability_set_id: '<availability_set_id>', # Optional
108
- publisher: 'Canonical', # Not required if custom image is being used
109
- offer: 'UbuntuServer', # Not required if custom image is being used
110
- sku: '14.04.2-LTS', # Not required if custom image is being used
111
- version: 'latest', # Not required if custom image is being used
112
- platform: 'Linux',
113
- vhd_path: '<Path of VHD>', # Optional, if you want to create the VM from a custom image.
114
- custom_data: 'echo customData', # Optional, if you want to add custom data in this VM.
115
- os_disk_caching: Fog::ARM::Compute::Models::CachingTypes::None, # Optional, can be one of None, ReadOnly, ReadWrite
116
- managed_disk_storage_type: Azure::ARM::Compute::Models::StorageAccountTypes::StandardLRS, # Optional, can be StandardLRS or PremiumLRS
117
- os_disk_size: <Disk Size> # Optional, size of the os disk in GB (upto 1023)
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; see link: https://msdn.microsoft.com/en-us/library/azure/mt163591.aspx
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
- servers = azure_compute_service.servers(resource_group: '<Resource Group name>')
158
- servers.each do |server|
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
- end
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
- server = azure_compute_service
170
- .servers(resource_group: '<Resource Group name>')
171
- .get('<Resource Group name>', 'Server name>')
172
- puts "#{server.name}"
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
- ## Attach a Data Disk to Server
179
+ ## Get a Server's status
176
180
 
177
- Get the server object and attach a Data Disk to it.
181
+ Check the status of a Server
178
182
 
179
- ```ruby
180
- server.attach_data_disk('<Disk Name>', <Size in GB>, '<Storage Account Name>')
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
- ## Detach a Data Disk from Server
191
+ ## Destroy a single Server
184
192
 
185
- Get the server object and detach a Data Disk from it.
193
+ Get a server object from the get method (described above) and then destroy that server.
186
194
 
187
195
  ```ruby
188
- server.detach_data_disk('<Disk Name>')
196
+ server.destroy
189
197
  ```
190
198
 
191
- ## Attach a Managed Data Disk to Server
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
- server.attach_managed_disk('<Disk Name>', '<Disk Resource Group Name>')
204
+ server.attach_data_disk('<Disk Name>', <Size in GBs>, '<Storage Account Name>')
197
205
  ```
198
206
 
199
- ## Detach a Managed Data Disk from Server
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
- server.detach_managed_disk('<Disk Name>')
212
+ server.detach_data_disk('<Disk Name>')
205
213
  ```
206
214
 
207
- ## Get a Server's status
215
+ ## Create Managed Disk
208
216
 
209
- Check the status of a Server
217
+ Create a new Premium Managed Disk
210
218
 
211
- ```ruby
212
- status = azure_compute_service
213
- .servers
214
- .get('<Resource Group name>', '<Server name>')
215
- .vm_status
216
- puts status
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
- ## Destroy a single Server
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
- server.destroy
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
- ## Check Availability Set Existence
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
- azure_compute_service.availability_sets.check_availability_set_exists(<Resource Group name>, <Availability Set name>)
252
+ server.attach_managed_disk('<Disk Name>', '<Disk Resource Group Name>')
231
253
  ```
232
254
 
233
- ## Create Availability Set
255
+ ## Detach a Managed Data Disk from Server
234
256
 
235
- Create a new availability set
257
+ Get the server object and detach a Data Disk from it.
236
258
 
237
259
  ```ruby
238
- azure_compute_service.availability_sets.create(
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 availability sets in a resource group
263
+ ## List Managed Disks in a Resource Group
264
+
265
+ List managed disks in a resource group
250
266
 
251
267
  ```ruby
252
- availability_sets = azure_compute_service.availability_sets(resource_group: '<Resource Group name>')
253
- availability_sets.each do |availability_set|
254
- puts "#{availability_set.name}"
255
- puts "#{availability_set.location}"
256
- end
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
- ## Retrieve a single Availability Set
275
+ ## List Managed Disks in a Subscription
260
276
 
261
- Get a single record of Availability Set
277
+ List managed disks in a subscription
262
278
 
263
279
  ```ruby
264
- availability_set = azure_compute_service
265
- .availability_sets
266
- .get('<Resource Group name>','<Availability Set name>')
267
- puts "#{availability_set.name}"
280
+ fog_compute_service.managed_disks.each do |disk|
281
+ puts "#{disk.name}"
282
+ puts "#{disk.location}"
283
+ end
268
284
  ```
269
285
 
270
- ## Destroy a single Availability Set
286
+ ## Grant Access to a Managed Disk
271
287
 
272
- Get an availability set object from the get method and then destroy that availability set.
288
+ Grant access to a managed disk
273
289
 
274
290
  ```ruby
275
- availability_set.destroy
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
- ## Check Virtual Machine Extension Existence
295
+ ## Revoke Access from a Managed Disk
296
+
297
+ Revoke access from a managed disk
279
298
 
280
299
  ```ruby
281
- azure_compute_service.virtual_machine_extensions.check_vm_extension_exists(<Resource Group name>, <Virtual Machine Name>, <Extension Name>)
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
- ## Create Virtual Machine Extension
285
-
286
- Installs an extension to the specified virtual machine.
304
+ ## Check Managed Disk Existence
287
305
 
288
306
  ```ruby
289
- azure_compute_service.virtual_machine_extensions.create(
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
- ## Get Extension from Virtual Machine
310
+ ## Retrieve a single Managed Disk
304
311
 
305
- Retrieves the given extension from the virtual machine
312
+ Get a single record of managed disks
306
313
 
307
314
  ```ruby
308
- vm_extension = azure_compute_service.virtual_machine_extensions.get(
309
- '<Resource Group Name>', '<Virtual Machine Name>', '<Extension Name>'
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
- ## Update Extension
321
+ ## Destroy a single Managed Disk
314
322
 
315
- Update the given extension. The attributes that can be modified are
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
- vm_extension.update(
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
- ## Destroy Extension
329
-
330
- Destroy the given extension from the virtual machine
329
+ ## Check Availability Set Existence
331
330
 
332
331
  ```ruby
333
- vm_extension.destroy
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
- ## Create Managed Disk
338
-
339
- Create a new Premium Managed Disk
337
+ Create a new availability set
340
338
 
341
339
  ```ruby
342
- azure_compute_service.managed_disks.create(
343
- name: 'disk_name',
344
- location: 'east us',
345
- resource_group_name: 'resource_group_name',
346
- account_type: 'Premium_LRS',
347
- disk_size_gb: 1023,
348
- creation_data: {
349
- create_option: 'Empty'
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
- Create a new Standard Managed Disk
351
+ List availability sets in a resource group
355
352
 
356
353
  ```ruby
357
- azure_compute_service.managed_disks.create(
358
- name: 'disk_name',
359
- location: 'east us',
360
- resource_group_name: 'resource_group_name',
361
- account_type: 'Standard_LRS',
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
- ## List Managed Disks in a Resource Group
361
+ ## Retrieve a single Availability Set
370
362
 
371
- List managed disks in a resource group
363
+ Get a single record of Availability Set
372
364
 
373
365
  ```ruby
374
- managed_disks = azure_compute_service.managed_disks(resource_group: '<Resource Group name>')
375
- mnaged_disks.each do |disk|
376
- puts "#{disk.name}"
377
- puts "#{disk.location}"
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
- ## List Managed Disks in a Subscription
372
+ ## Destroy a single Availability Set
382
373
 
383
- List managed disks in a subscription
374
+ Get an availability set object from the get method and then destroy that availability set.
384
375
 
385
376
  ```ruby
386
- azure_compute_service.managed_disks.each do |disk|
387
- puts "#{disk.name}"
388
- puts "#{disk.location}"
389
- end
377
+ availability_set.destroy
390
378
  ```
391
379
 
392
- ## Grant Access to a Managed Disk
393
-
394
- Grant access to a managed disk
380
+ ## Check Virtual Machine Extension Existence
395
381
 
396
382
  ```ruby
397
- access_sas = azure_compute_service.managed_disks.grant_access('<resource_group_name>', '<disk_name>', 'Read', 1000)
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
- ## Revoke Access from a Managed Disk
386
+ ## Create Virtual Machine Extension
402
387
 
403
- Revoke access from a managed disk
388
+ Installs an extension to the specified virtual machine.
404
389
 
405
390
  ```ruby
406
- response = azure_compute_service.managed_disks.revoke_access('<resource_group_name>', '<disk_name>')
407
- puts "Revoke Access response status: #{response.status}"
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
- ## Check Managed Disk Existence
405
+ ## Get Extension from Virtual Machine
406
+
407
+ Retrieves the given extension from the virtual machine
411
408
 
412
409
  ```ruby
413
- azure_compute_service.managed_disks.check_managed_disk_exists(<Resource Group name>, <Disk name>)
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
- ## Retrieve a single Managed Disk
415
+ ## Update Extension
417
416
 
418
- Get a single record of managed disks
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
- managed_disk = azure_compute_service
422
- .managed_disks
423
- .get('<Resource Group name>','<Disk name>')
424
- puts "#{managed_disk.name}"
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 a single Managed Disk
430
+ ## Destroy Extension
428
431
 
429
- Get an managed disk object from the get method and then destroy that managed disk.
432
+ Destroy the given extension from the virtual machine
430
433
 
431
434
  ```ruby
432
- managed_disk.destroy
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.