fog-azure-rm-temp 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +0 -5
  3. data/fog-azure-rm.gemspec +1 -1
  4. data/lib/fog/azurerm/compute.rb +2 -0
  5. data/lib/fog/azurerm/docs/storage.md +66 -0
  6. data/lib/fog/azurerm/models/compute/creation_data.rb +4 -2
  7. data/lib/fog/azurerm/models/compute/data_disk.rb +26 -0
  8. data/lib/fog/azurerm/models/compute/managed_disk.rb +5 -4
  9. data/lib/fog/azurerm/models/compute/server.rb +24 -3
  10. data/lib/fog/azurerm/models/storage/recovery_vault.rb +50 -0
  11. data/lib/fog/azurerm/models/storage/recovery_vaults.rb +27 -0
  12. data/lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb +49 -13
  13. data/lib/fog/azurerm/requests/compute/detach_data_disk_from_vm.rb +1 -2
  14. data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +54 -0
  15. data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +35 -0
  16. data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +60 -0
  17. data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +61 -0
  18. data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +56 -0
  19. data/lib/fog/azurerm/requests/storage/get_backup_container.rb +53 -0
  20. data/lib/fog/azurerm/requests/storage/get_backup_item.rb +58 -0
  21. data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +53 -0
  22. data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +64 -0
  23. data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +49 -0
  24. data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +48 -0
  25. data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +36 -0
  26. data/lib/fog/azurerm/requests/storage/start_backup.rb +54 -0
  27. data/lib/fog/azurerm/storage.rb +18 -1
  28. data/lib/fog/azurerm/version.rb +1 -1
  29. data/test/api_stub.rb +2 -0
  30. data/test/api_stub/models/compute/server.rb +62 -0
  31. data/test/api_stub/models/storage/recovery_vault.rb +23 -0
  32. data/test/api_stub/requests/compute/virtual_machine.rb +77 -0
  33. data/test/api_stub/requests/storage/recovery_vault.rb +189 -0
  34. data/test/models/{storage → compute}/test_data_disk.rb +2 -2
  35. data/test/models/compute/test_server.rb +27 -1
  36. data/test/models/storage/test_recovery_vault.rb +61 -0
  37. data/test/models/storage/test_recovery_vaults.rb +47 -0
  38. data/test/requests/compute/test_attach_data_disk_to_vm.rb +21 -6
  39. data/test/requests/storage/test_create_recovery_vault.rb +35 -0
  40. data/test/requests/storage/test_delete_recovery_vault.rb +34 -0
  41. data/test/requests/storage/test_disable_backup_protection.rb +52 -0
  42. data/test/requests/storage/test_enable_backup_protection.rb +66 -0
  43. data/test/requests/storage/test_get_all_backup_jobs.rb +35 -0
  44. data/test/requests/storage/test_get_backup_container.rb +35 -0
  45. data/test/requests/storage/test_get_backup_item.rb +35 -0
  46. data/test/requests/storage/test_get_backup_job_for_vm.rb +26 -0
  47. data/test/requests/storage/test_get_backup_protection_policy.rb +35 -0
  48. data/test/requests/storage/test_get_recovery_vault.rb +35 -0
  49. data/test/requests/storage/test_list_recovery_vault.rb +35 -0
  50. data/test/requests/storage/test_set_recovery_vault_context.rb +34 -0
  51. data/test/requests/storage/test_start_backup.rb +55 -0
  52. data/test/test_helper.rb +14 -0
  53. metadata +38 -13
  54. data/.arclint +0 -8
  55. data/lib/fog/azurerm/models/storage/data_disk.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddafc1d170ef4e73a60717a3b4316616f21b9bf1
4
- data.tar.gz: 338b0d9155871c2849bdde8587b6317a930ffc4b
3
+ metadata.gz: 3289ed97aa95d2ba48f1753d19326183d1a6958b
4
+ data.tar.gz: 678a07be7e5409dc09659899a6565afef836c402
5
5
  SHA512:
6
- metadata.gz: 8d1be01e59a72b7ccf3e322b0208fc8a07f5d4884574833c8bdcd5c8a139c607660fa8e47b8ce76acb87d609ebf9ebcb65a8caacdb08481479e7b74f899070cc
7
- data.tar.gz: 87db374741759151abc13a4d074254db384ac96fe1848fe817c73bcdbc9548daedb792a447572fb8ef00fae4e9de34414fb856ba113c40bf7fab36b3b2c4f876
6
+ metadata.gz: b603a55dad7948963ef74e730e74caa5780332f90876ec4dae070f8cf2d97c8d818293e64a0dd89b593f6f479c6e7e11acc2a08817df1430f830eeeb0d680f1a
7
+ data.tar.gz: 286cc87a71d1d82b723706cde2f73fbf4f05f7275adee37dda60613e0c59d94f19bf9ceb6197c47220bc6ac53c9e56ae593824cc22605f7efe2c8e602aef8572
data/CHANGELOG.md CHANGED
@@ -1,8 +1,3 @@
1
- ## 0.3.4 (Upcoming)
2
-
3
- **Removed:**
4
- - Recovery Vault Support
5
-
6
1
  ## 0.3.3
7
2
 
8
3
  **Added:**
data/fog-azure-rm.gemspec CHANGED
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'azure_mgmt_traffic_manager', '~> 0.9.0'
33
33
  spec.add_dependency 'azure_mgmt_sql', '~> 0.9.0'
34
34
  spec.add_dependency 'azure_mgmt_key_vault', '~> 0.9.0'
35
- spec.add_dependency 'azure-storage', '>= 0.11.5.preview', '< 1.0'
35
+ spec.add_dependency 'azure-storage', '= 0.11.5.preview'
36
36
  spec.add_dependency 'vhd', '0.0.4'
37
37
  end
@@ -42,6 +42,7 @@ module Fog
42
42
  request :revoke_access_to_managed_disk
43
43
  request :grant_access_to_managed_disk
44
44
 
45
+
45
46
  model_path 'fog/azurerm/models/compute'
46
47
  model :availability_set
47
48
  collection :availability_sets
@@ -51,6 +52,7 @@ module Fog
51
52
  collection :virtual_machine_extensions
52
53
  model :managed_disk
53
54
  collection :managed_disks
55
+ model :data_disk
54
56
  model :creation_data
55
57
  model :disk_create_option
56
58
  model :encryption_settings
@@ -389,6 +389,72 @@ directory.metadata = {
389
389
  directory.save(is_create: false)
390
390
  ```
391
391
 
392
+ ### Create Recovery Vault
393
+
394
+ Create a new Recovery Vault object
395
+
396
+ ```ruby
397
+ azure_storage_service.recovery_vaults.create(
398
+ name: '<vault_name>',
399
+ location: '<location>',
400
+ resource_group: '<resource_group_name>'
401
+ ```
402
+
403
+ ### Get Recovery Vault
404
+
405
+ Retrieves a Recovery Vault object
406
+
407
+ ```ruby
408
+ recovery_vault = azure_storage_service.recovery_vaults.get(
409
+ 'Vault Name',
410
+ 'Vault Resource Group'
411
+ )
412
+ ```
413
+
414
+ ### List Recovery Vaults
415
+
416
+ List the Recovery Vaults in a resource group
417
+
418
+ ```ruby
419
+ azure_storage_service.recovery_vaults('Resource Group Name').each do |recovery_vault|
420
+ puts recovery_vault.inspect
421
+ end
422
+ ```
423
+
424
+ ### Enable Backup Protection
425
+
426
+ Enables backup protection for a virtual machine in the recovery vault. Backup protection for a virtual machine must be enabled before running backup.
427
+
428
+ ```ruby
429
+ recovery_vault.enable_backup_protection('Virtual Machine Name', 'Virtual Machine Resource Group')
430
+ ```
431
+
432
+ ### Disable Backup Protection
433
+
434
+ Disables backup protection for a virtual machine in the recovery vault.
435
+
436
+ ```ruby
437
+ recovery_vault.disable_backup_protection('Virtual Machine Name', 'Virtual Machine Resource Group')
438
+ ```
439
+
440
+ ### Start Backup
441
+
442
+ Starts the backup process for a given virtual machine
443
+
444
+ ```ruby
445
+ recovery_vault.start_backup('Virtual Machine Name', 'Virtual Machine Resource Group')
446
+ ```
447
+
448
+ ### Destroy Recovery Vault
449
+
450
+ Destroys the Recovery Vault
451
+
452
+ ```ruby
453
+ recovery_vault.destroy
454
+ ```
455
+
456
+ Note that a Recovery Vault must not contain any backup protectable items or tasks running in order for you to delete it. If any item is present, it must be deleted from the portal first before running this command.
457
+
392
458
  ## Support and Feedback
393
459
  Your feedback is appreciated! If you have specific issues with the fog ARM, you should file an issue via Github.
394
460
 
@@ -11,8 +11,10 @@ module Fog
11
11
 
12
12
  def self.parse(creation_data)
13
13
  data = get_hash_from_object(creation_data)
14
- image_reference = Fog::Compute::AzureRM::ImageDiskReference.new
15
- data['image_reference'] = image_reference.merge_attributes(Fog::Compute::AzureRM::ImageDiskReference.parse(creation_data.image_reference))
14
+ unless creation_data.image_reference.nil?
15
+ image_reference = Fog::Compute::AzureRM::ImageDiskReference.new
16
+ data['image_reference'] = image_reference.merge_attributes(Fog::Compute::AzureRM::ImageDiskReference.parse(creation_data.image_reference))
17
+ end
16
18
  data
17
19
  end
18
20
  end
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Compute
3
+ class AzureRM
4
+ # DataDisk Model for Compute Service
5
+ class DataDisk < Fog::Model
6
+ identity :name
7
+ attribute :disk_size_gb
8
+ attribute :lun
9
+ attribute :caching
10
+ attribute :create_option
11
+ # For these composite objects we ONLY need one field
12
+ attribute :vhd_uri
13
+ attribute :image_uri
14
+ attribute :managed_disk_id
15
+
16
+ def self.parse(disk)
17
+ disk_hash = get_hash_from_object(disk)
18
+ disk_hash['vhd_uri'] = disk.vhd.uri if disk.vhd
19
+ disk_hash['image_uri'] = disk.image.uri if disk.image
20
+ disk_hash['managed_disk_id'] = disk.managed_disk.id if disk.managed_disk
21
+ disk_hash
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -6,17 +6,18 @@ module Fog
6
6
  class ManagedDisk < Fog::Model
7
7
  attribute :id
8
8
  identity :name
9
- attribute :resource_group_name
10
9
  attribute :type
11
10
  attribute :location
11
+ attribute :resource_group_name
12
12
  attribute :account_type
13
- attribute :time_created
14
- attribute :os_type
15
13
  attribute :disk_size_gb
16
14
  attribute :owner_id
17
15
  attribute :provisioning_state
18
16
  attribute :tags
17
+ attribute :time_created
19
18
  attribute :creation_data
19
+
20
+ attribute :os_type
20
21
  attribute :encryption_settings
21
22
 
22
23
  def self.parse(managed_disk)
@@ -39,7 +40,7 @@ module Fog
39
40
 
40
41
  def save
41
42
  requires :name, :location, :resource_group_name, :creation_data
42
- requires :disk_size_gb if creation_data[:create_option] == 'Empty'
43
+ requires :disk_size_gb, :account_type
43
44
  validate_creation_data_params(creation_data)
44
45
 
45
46
  disk = service.create_or_update_managed_disk(managed_disk_params)
@@ -63,8 +63,8 @@ module Fog
63
63
 
64
64
  unless vm.storage_profile.data_disks.nil?
65
65
  vm.storage_profile.data_disks.each do |disk|
66
- data_disk = Fog::Storage::AzureRM::DataDisk.new
67
- hash['data_disks'] << data_disk.merge_attributes(Fog::Storage::AzureRM::DataDisk.parse(disk))
66
+ data_disk = Fog::Compute::AzureRM::DataDisk.new
67
+ hash['data_disks'] << data_disk.merge_attributes(Fog::Compute::AzureRM::DataDisk.parse(disk))
68
68
  end
69
69
  end
70
70
 
@@ -146,7 +146,7 @@ module Fog
146
146
  end
147
147
 
148
148
  def attach_data_disk(disk_name, disk_size, storage_account_name, async = false)
149
- response = service.attach_data_disk_to_vm(resource_group, name, disk_name, disk_size, storage_account_name, async)
149
+ response = service.attach_data_disk_to_vm(data_disk_params(disk_name, disk_size, storage_account_name), async)
150
150
  async ? create_fog_async_response(response) : merge_attributes(Fog::Compute::AzureRM::Server.parse(response))
151
151
  end
152
152
 
@@ -155,6 +155,16 @@ module Fog
155
155
  async ? create_fog_async_response(response) : merge_attributes(Fog::Compute::AzureRM::Server.parse(response))
156
156
  end
157
157
 
158
+ def attach_managed_disk(disk_name, disk_resource_group, async=false)
159
+ response = service.attach_data_disk_to_vm(data_disk_params(disk_name, nil, nil, disk_resource_group), async)
160
+ async ? create_fog_async_response(response) : merge_attributes(Fog::Compute::AzureRM::Server.parse(response))
161
+ end
162
+
163
+ def detach_managed_disk(disk_name, async=false)
164
+ response = service.detach_data_disk_from_vm(resource_group, name, disk_name, async)
165
+ async ? create_fog_async_response(response) : merge_attributes(Fog::Compute::AzureRM::Server.parse(response))
166
+ end
167
+
158
168
  private
159
169
 
160
170
  def platform_is_linux?(platform)
@@ -193,6 +203,17 @@ module Fog
193
203
  managed_disk_storage_type: managed_disk_storage_type
194
204
  }
195
205
  end
206
+
207
+ def data_disk_params(disk_name, disk_size=nil, storage_account=nil, disk_resource_group=nil)
208
+ {
209
+ vm_name: name,
210
+ vm_resource_group: resource_group,
211
+ disk_name: disk_name,
212
+ disk_size_gb: disk_size,
213
+ storage_account_name: storage_account,
214
+ disk_resource_group: disk_resource_group
215
+ }
216
+ end
196
217
  end
197
218
  end
198
219
  end
@@ -0,0 +1,50 @@
1
+ module Fog
2
+ module Storage
3
+ class AzureRM
4
+ # This class is giving implementation of create/save and
5
+ # delete/destroy for Recovery Vault.
6
+ class RecoveryVault < Fog::Model
7
+ attribute :id
8
+ identity :name
9
+ attribute :resource_group
10
+ attribute :location
11
+ attribute :type
12
+ attribute :sku_name
13
+
14
+ def self.parse(recovery_vault)
15
+ {
16
+ id: recovery_vault['id'],
17
+ name: recovery_vault['name'],
18
+ resource_group: get_resource_group_from_id(recovery_vault['id']),
19
+ location: recovery_vault['location'],
20
+ type: recovery_vault['type'],
21
+ sku_name: recovery_vault['sku']['name']
22
+ }
23
+ end
24
+
25
+ def save
26
+ requires :name, :location, :resource_group
27
+ recovery_vault = service.create_or_update_recovery_vault(resource_group, location, name)
28
+ merge_attributes(Fog::Storage::AzureRM::RecoveryVault.parse(recovery_vault))
29
+ end
30
+
31
+ def enable_backup_protection(vm_name, vm_resource_group)
32
+ requires :name, :resource_group
33
+ service.enable_backup_protection(name, resource_group, vm_name, vm_resource_group)
34
+ end
35
+
36
+ def start_backup(vm_name, vm_resource_group)
37
+ service.start_backup(resource_group, name, vm_name, vm_resource_group)
38
+ end
39
+
40
+ def disable_backup_protection(vm_name, vm_resource_group)
41
+ service.disable_backup_protection(name, resource_group, vm_name, vm_resource_group)
42
+ end
43
+
44
+ def destroy
45
+ service.delete_recovery_vault(resource_group, name)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Storage
3
+ class AzureRM
4
+ # This class is giving implementation of all/get for Recovery Vaults
5
+ class RecoveryVaults < Fog::Collection
6
+ model Fog::Storage::AzureRM::RecoveryVault
7
+ attribute :resource_group
8
+ attribute :name
9
+
10
+ def all
11
+ requires :resource_group
12
+ recovery_vaults = []
13
+ service.list_recovery_vaults(resource_group).each do |recovery_vault|
14
+ recovery_vaults << Fog::Storage::AzureRM::RecoveryVault.parse(recovery_vault)
15
+ end
16
+ load(recovery_vaults)
17
+ end
18
+
19
+ def get(resource_group, name)
20
+ recovery_vault = service.get_recovery_vault(resource_group, name)
21
+ recovery_vault_fog = Fog::Storage::AzureRM::RecoveryVault.new(service: service)
22
+ recovery_vault_fog.merge_attributes(Fog::Storage::AzureRM::RecoveryVault.parse(recovery_vault))
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -3,20 +3,35 @@ module Fog
3
3
  class AzureRM
4
4
  # This class provides the actual implementation for service calls.
5
5
  class Real
6
- def attach_data_disk_to_vm(resource_group, vm_name, disk_name, disk_size, storage_account_name, async)
7
- msg = "Attaching Data Disk #{disk_name} to Virtual Machine #{vm_name} in Resource Group #{resource_group}"
6
+ def attach_data_disk_to_vm(disk_params, async)
7
+ # Variable un-packing for easy access
8
+ vm_name = disk_params[:vm_name]
9
+ vm_resource_group = disk_params[:vm_resource_group]
10
+ disk_name = disk_params[:disk_name]
11
+ disk_resource_group = disk_params[:disk_resource_group]
12
+ disk_size = disk_params[:disk_size_gb]
13
+ storage_account_name = disk_params[:storage_account_name]
14
+
15
+ msg = "Attaching Data Disk #{disk_name} to Virtual Machine #{vm_name} in Resource Group #{vm_resource_group}"
8
16
  Fog::Logger.debug msg
9
- vm = get_virtual_machine_instance(resource_group, vm_name, @compute_mgmt_client)
17
+ vm = get_virtual_machine_instance(vm_resource_group, vm_name)
10
18
  lun = get_logical_unit_number(vm.storage_profile.data_disks)
11
- access_key = get_storage_access_key(resource_group, storage_account_name, @storage_mgmt_client)
12
- data_disk = get_data_disk_object(disk_name, disk_size, lun, storage_account_name, access_key)
19
+
20
+ # Attach data disk to VM
21
+ if storage_account_name
22
+ # Un-managed data disk
23
+ access_key = get_storage_access_key(vm_resource_group, storage_account_name)
24
+ data_disk = get_unmanaged_disk_object(disk_name, disk_size, lun, storage_account_name, access_key)
25
+ elsif disk_resource_group
26
+ # Managed data disk
27
+ data_disk = get_data_disk_object(disk_resource_group, disk_name, lun)
28
+ end
13
29
  vm.storage_profile.data_disks.push(data_disk)
14
- vm.resources = nil
15
30
  begin
16
31
  if async
17
- response = @compute_mgmt_client.virtual_machines.create_or_update_async(resource_group, vm_name, vm)
32
+ response = @compute_mgmt_client.virtual_machines.create_or_update_async(vm_resource_group, vm_name, vm)
18
33
  else
19
- virtual_machine = @compute_mgmt_client.virtual_machines.create_or_update(resource_group, vm_name, vm)
34
+ virtual_machine = @compute_mgmt_client.virtual_machines.create_or_update(vm_resource_group, vm_name, vm)
20
35
  end
21
36
  rescue MsRestAzure::AzureOperationError => e
22
37
  if e.body.to_s =~ /InvalidParameter/ && e.body.to_s =~ /already exists/
@@ -35,11 +50,11 @@ module Fog
35
50
 
36
51
  private
37
52
 
38
- def get_virtual_machine_instance(resource_group, vm_name, client)
53
+ def get_virtual_machine_instance(resource_group, vm_name)
39
54
  msg = "Getting Virtual Machine #{vm_name} from Resource Group #{resource_group}"
40
55
  Fog::Logger.debug msg
41
56
  begin
42
- virtual_machine = client.virtual_machines.get(resource_group, vm_name)
57
+ virtual_machine = @compute_mgmt_client.virtual_machines.get(resource_group, vm_name)
43
58
  rescue MsRestAzure::AzureOperationError => e
44
59
  raise_azure_exception(e, msg)
45
60
  end
@@ -60,11 +75,32 @@ module Fog
60
75
  lun_range_list[0]
61
76
  end
62
77
 
63
- def get_storage_access_key(resource_group, storage_account_name, storage_client)
78
+ def get_data_disk_object(disk_resource_group, disk_name, lun)
79
+ msg = "Getting Managed Disk #{disk_name} from Resource Group #{disk_resource_group}"
80
+ begin
81
+ disk = @compute_mgmt_client.disks.get(disk_resource_group, disk_name)
82
+ rescue MsRestAzure::AzureOperationError => e
83
+ Fog::Logger.debug msg
84
+ raise_azure_exception(e, msg)
85
+ end
86
+ managed_disk = Azure::ARM::Compute::Models::DataDisk.new
87
+ managed_disk.name = disk_name
88
+ managed_disk.lun = lun
89
+ managed_disk.create_option = Azure::ARM::Compute::Models::DiskCreateOptionTypes::Attach
90
+
91
+ # Managed disk parameter
92
+ managed_disk_params = Azure::ARM::Compute::Models::ManagedDiskParameters.new
93
+ managed_disk_params.id = disk.id
94
+ managed_disk.managed_disk = managed_disk_params
95
+
96
+ managed_disk
97
+ end
98
+
99
+ def get_storage_access_key(resource_group, storage_account_name)
64
100
  msg = "Getting Storage Access Keys from Resource Group #{resource_group}"
65
101
  Fog::Logger.debug msg
66
102
  begin
67
- storage_account_keys = storage_client.storage_accounts.list_keys(resource_group, storage_account_name)
103
+ storage_account_keys = @storage_mgmt_client.storage_accounts.list_keys(resource_group, storage_account_name)
68
104
  rescue MsRestAzure::AzureOperationError => e
69
105
  raise_azure_exception(e, msg)
70
106
  end
@@ -72,7 +108,7 @@ module Fog
72
108
  storage_account_keys.keys[0].value
73
109
  end
74
110
 
75
- def get_data_disk_object(disk_name, disk_size, lun, storage_account_name, access_key)
111
+ def get_unmanaged_disk_object(disk_name, disk_size, lun, storage_account_name, access_key)
76
112
  data_disk = Azure::ARM::Compute::Models::DataDisk.new
77
113
  data_disk.name = disk_name
78
114
  data_disk.lun = lun
@@ -6,13 +6,12 @@ module Fog
6
6
  def detach_data_disk_from_vm(resource_group, vm_name, disk_name, async)
7
7
  msg = "Detaching Data Disk #{disk_name} from Virtual Machine #{vm_name} in Resource Group #{resource_group}."
8
8
  Fog::Logger.debug msg
9
- vm = get_virtual_machine_instance(resource_group, vm_name, @compute_mgmt_client)
9
+ vm = get_virtual_machine_instance(resource_group, vm_name)
10
10
  vm.storage_profile.data_disks.each_with_index do |disk, index|
11
11
  if disk.name == disk_name
12
12
  vm.storage_profile.data_disks.delete_at(index)
13
13
  end
14
14
  end
15
- vm.resources = nil
16
15
  begin
17
16
  if async
18
17
  response = @compute_mgmt_client.virtual_machines.create_or_update_async(resource_group, vm_name, vm)