azure_mgmt_compute 0.8.0 → 0.9.0

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.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_compute.rb +86 -54
  3. data/lib/generated/azure_mgmt_compute/availability_sets.rb +17 -6
  4. data/lib/generated/azure_mgmt_compute/compute_management_client.rb +17 -6
  5. data/lib/generated/azure_mgmt_compute/disks.rb +1273 -0
  6. data/lib/generated/azure_mgmt_compute/images.rb +808 -0
  7. data/lib/generated/azure_mgmt_compute/models/access_level.rb +16 -0
  8. data/lib/generated/azure_mgmt_compute/models/access_uri.rb +45 -0
  9. data/lib/generated/azure_mgmt_compute/models/additional_unattend_content.rb +1 -1
  10. data/lib/generated/azure_mgmt_compute/models/api_entity_reference.rb +1 -1
  11. data/lib/generated/azure_mgmt_compute/models/api_error.rb +5 -5
  12. data/lib/generated/azure_mgmt_compute/models/api_error_base.rb +3 -3
  13. data/lib/generated/azure_mgmt_compute/models/availability_set.rb +21 -0
  14. data/lib/generated/azure_mgmt_compute/models/container_service.rb +1 -1
  15. data/lib/generated/azure_mgmt_compute/models/container_service_agent_pool_profile.rb +2 -1
  16. data/lib/generated/azure_mgmt_compute/models/container_service_diagnostics_profile.rb +1 -1
  17. data/lib/generated/azure_mgmt_compute/models/container_service_linux_profile.rb +1 -1
  18. data/lib/generated/azure_mgmt_compute/models/container_service_list_result.rb +1 -1
  19. data/lib/generated/azure_mgmt_compute/models/container_service_ssh_configuration.rb +1 -1
  20. data/lib/generated/azure_mgmt_compute/models/container_service_windows_profile.rb +1 -1
  21. data/lib/generated/azure_mgmt_compute/models/creation_data.rb +94 -0
  22. data/lib/generated/azure_mgmt_compute/models/data_disk.rb +13 -2
  23. data/lib/generated/azure_mgmt_compute/models/disk.rb +174 -0
  24. data/lib/generated/azure_mgmt_compute/models/disk_create_option.rb +20 -0
  25. data/lib/generated/azure_mgmt_compute/models/disk_list.rb +94 -0
  26. data/lib/generated/azure_mgmt_compute/models/disk_update.rb +109 -0
  27. data/lib/generated/azure_mgmt_compute/models/encryption_settings.rb +72 -0
  28. data/lib/generated/azure_mgmt_compute/models/grant_access_data.rb +56 -0
  29. data/lib/generated/azure_mgmt_compute/models/image.rb +113 -0
  30. data/lib/generated/azure_mgmt_compute/models/image_data_disk.rb +99 -0
  31. data/lib/generated/azure_mgmt_compute/models/image_disk_reference.rb +57 -0
  32. data/lib/generated/azure_mgmt_compute/models/image_list_result.rb +94 -0
  33. data/lib/generated/azure_mgmt_compute/models/image_osdisk.rb +113 -0
  34. data/lib/generated/azure_mgmt_compute/models/image_reference.rb +8 -1
  35. data/lib/generated/azure_mgmt_compute/models/image_storage_profile.rb +63 -0
  36. data/lib/generated/azure_mgmt_compute/models/inner_error.rb +2 -2
  37. data/lib/generated/azure_mgmt_compute/models/key_vault_and_key_reference.rb +57 -0
  38. data/lib/generated/azure_mgmt_compute/models/key_vault_and_secret_reference.rb +56 -0
  39. data/lib/generated/azure_mgmt_compute/models/managed_disk_parameters.rb +53 -0
  40. data/lib/generated/azure_mgmt_compute/models/operating_system_state_types.rb +16 -0
  41. data/lib/generated/azure_mgmt_compute/models/operation_status_response.rb +90 -0
  42. data/lib/generated/azure_mgmt_compute/models/osdisk.rb +14 -3
  43. data/lib/generated/azure_mgmt_compute/models/osprofile.rb +2 -2
  44. data/lib/generated/azure_mgmt_compute/models/resource_update.rb +51 -0
  45. data/lib/generated/azure_mgmt_compute/models/snapshot.rb +174 -0
  46. data/lib/generated/azure_mgmt_compute/models/snapshot_list.rb +94 -0
  47. data/lib/generated/azure_mgmt_compute/models/snapshot_update.rb +109 -0
  48. data/lib/generated/azure_mgmt_compute/models/source_vault.rb +45 -0
  49. data/lib/generated/azure_mgmt_compute/models/storage_account_types.rb +16 -0
  50. data/lib/generated/azure_mgmt_compute/models/sub_resource_read_only.rb +46 -0
  51. data/lib/generated/azure_mgmt_compute/models/upgrade_policy.rb +1 -1
  52. data/lib/generated/azure_mgmt_compute/models/virtual_machine.rb +1 -1
  53. data/lib/generated/azure_mgmt_compute/models/virtual_machine_extension.rb +7 -7
  54. data/lib/generated/azure_mgmt_compute/models/virtual_machine_extension_handler_instance_view.rb +3 -3
  55. data/lib/generated/azure_mgmt_compute/models/virtual_machine_extension_image.rb +5 -5
  56. data/lib/generated/azure_mgmt_compute/models/virtual_machine_extension_instance_view.rb +5 -5
  57. data/lib/generated/azure_mgmt_compute/models/virtual_machine_instance_view.rb +2 -2
  58. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set.rb +27 -4
  59. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_data_disk.rb +101 -0
  60. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_extension.rb +8 -7
  61. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_extension_profile.rb +1 -1
  62. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view.rb +3 -3
  63. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view_statuses_summary.rb +1 -1
  64. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_ipconfiguration.rb +5 -5
  65. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_result.rb +2 -2
  66. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_skus_result.rb +2 -2
  67. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_with_link_result.rb +2 -2
  68. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_managed_disk_parameters.rb +47 -0
  69. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration.rb +3 -3
  70. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_network_profile.rb +1 -1
  71. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_osdisk.rb +19 -7
  72. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_osprofile.rb +7 -7
  73. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_sku.rb +3 -3
  74. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_sku_capacity.rb +4 -4
  75. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_storage_profile.rb +20 -2
  76. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vm.rb +21 -10
  77. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmextensions_summary.rb +2 -2
  78. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_ids.rb +1 -1
  79. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_required_ids.rb +1 -1
  80. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_view.rb +19 -8
  81. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmlist_result.rb +2 -2
  82. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmprofile.rb +4 -4
  83. data/lib/generated/azure_mgmt_compute/models/virtual_machine_status_code_count.rb +2 -2
  84. data/lib/generated/azure_mgmt_compute/snapshots.rb +1273 -0
  85. data/lib/generated/azure_mgmt_compute/usage_operations.rb +1 -1
  86. data/lib/generated/azure_mgmt_compute/version.rb +1 -1
  87. data/lib/generated/azure_mgmt_compute/virtual_machine_extension_images.rb +3 -3
  88. data/lib/generated/azure_mgmt_compute/virtual_machine_extensions.rb +21 -6
  89. data/lib/generated/azure_mgmt_compute/virtual_machine_images.rb +5 -5
  90. data/lib/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb +263 -26
  91. data/lib/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb +298 -37
  92. data/lib/generated/azure_mgmt_compute/virtual_machine_sizes.rb +1 -1
  93. data/lib/generated/azure_mgmt_compute/virtual_machines.rb +270 -32
  94. metadata +36 -4
@@ -12,26 +12,26 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [String] the computer name prefix.
15
+ # @return [String] The computer name prefix.
16
16
  attr_accessor :computer_name_prefix
17
17
 
18
- # @return [String] the admin user name.
18
+ # @return [String] The admin user name.
19
19
  attr_accessor :admin_username
20
20
 
21
- # @return [String] the admin user password.
21
+ # @return [String] The admin user password.
22
22
  attr_accessor :admin_password
23
23
 
24
- # @return [String] a base-64 encoded string of custom data.
24
+ # @return [String] A base-64 encoded string of custom data.
25
25
  attr_accessor :custom_data
26
26
 
27
- # @return [WindowsConfiguration] the Windows Configuration of the OS
27
+ # @return [WindowsConfiguration] The Windows Configuration of the OS
28
28
  # profile.
29
29
  attr_accessor :windows_configuration
30
30
 
31
- # @return [LinuxConfiguration] the Linux Configuration of the OS profile.
31
+ # @return [LinuxConfiguration] The Linux Configuration of the OS profile.
32
32
  attr_accessor :linux_configuration
33
33
 
34
- # @return [Array<VaultSecretGroup>] the List of certificates for addition
34
+ # @return [Array<VaultSecretGroup>] The List of certificates for addition
35
35
  # to the VM.
36
36
  attr_accessor :secrets
37
37
 
@@ -12,13 +12,13 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [String] the type of resource the sku applies to.
15
+ # @return [String] The type of resource the sku applies to.
16
16
  attr_accessor :resource_type
17
17
 
18
- # @return [Sku] the Sku.
18
+ # @return [Sku] The Sku.
19
19
  attr_accessor :sku
20
20
 
21
- # @return [VirtualMachineScaleSetSkuCapacity] available scaling
21
+ # @return [VirtualMachineScaleSetSkuCapacity] Available scaling
22
22
  # information.
23
23
  attr_accessor :capacity
24
24
 
@@ -12,16 +12,16 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [Integer] the minimum capacity.
15
+ # @return [Integer] The minimum capacity.
16
16
  attr_accessor :minimum
17
17
 
18
- # @return [Integer] the maximum capacity that can be set.
18
+ # @return [Integer] The maximum capacity that can be set.
19
19
  attr_accessor :maximum
20
20
 
21
- # @return [Integer] the default capacity.
21
+ # @return [Integer] The default capacity.
22
22
  attr_accessor :default_capacity
23
23
 
24
- # @return [VirtualMachineScaleSetSkuScaleType] the scale type applicable
24
+ # @return [VirtualMachineScaleSetSkuScaleType] The scale type applicable
25
25
  # to the sku. Possible values include: 'Automatic', 'None'
26
26
  attr_accessor :scale_type
27
27
 
@@ -12,12 +12,15 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [ImageReference] the image reference.
15
+ # @return [ImageReference] The image reference.
16
16
  attr_accessor :image_reference
17
17
 
18
- # @return [VirtualMachineScaleSetOSDisk] the OS disk.
18
+ # @return [VirtualMachineScaleSetOSDisk] The OS disk.
19
19
  attr_accessor :os_disk
20
20
 
21
+ # @return [Array<VirtualMachineScaleSetDataDisk>] The data disks.
22
+ attr_accessor :data_disks
23
+
21
24
 
22
25
  #
23
26
  # Mapper for VirtualMachineScaleSetStorageProfile class as Ruby Hash.
@@ -46,6 +49,21 @@ module Azure::ARM::Compute
46
49
  name: 'Composite',
47
50
  class_name: 'VirtualMachineScaleSetOSDisk'
48
51
  }
52
+ },
53
+ data_disks: {
54
+ required: false,
55
+ serialized_name: 'dataDisks',
56
+ type: {
57
+ name: 'Sequence',
58
+ element: {
59
+ required: false,
60
+ serialized_name: 'VirtualMachineScaleSetDataDiskElementType',
61
+ type: {
62
+ name: 'Composite',
63
+ class_name: 'VirtualMachineScaleSetDataDisk'
64
+ }
65
+ }
66
+ }
49
67
  }
50
68
  }
51
69
  }
@@ -22,33 +22,36 @@ module Azure::ARM::Compute
22
22
  # to the virtual machine.
23
23
  attr_accessor :latest_model_applied
24
24
 
25
- # @return [VirtualMachineInstanceView] the virtual machine instance view.
25
+ # @return [String] Azure VM unique ID.
26
+ attr_accessor :vm_id
27
+
28
+ # @return [VirtualMachineInstanceView] The virtual machine instance view.
26
29
  attr_accessor :instance_view
27
30
 
28
- # @return [HardwareProfile] the hardware profile.
31
+ # @return [HardwareProfile] The hardware profile.
29
32
  attr_accessor :hardware_profile
30
33
 
31
- # @return [StorageProfile] the storage profile.
34
+ # @return [StorageProfile] The storage profile.
32
35
  attr_accessor :storage_profile
33
36
 
34
- # @return [OSProfile] the OS profile.
37
+ # @return [OSProfile] The OS profile.
35
38
  attr_accessor :os_profile
36
39
 
37
- # @return [NetworkProfile] the network profile.
40
+ # @return [NetworkProfile] The network profile.
38
41
  attr_accessor :network_profile
39
42
 
40
- # @return [DiagnosticsProfile] the diagnostics profile.
43
+ # @return [DiagnosticsProfile] The diagnostics profile.
41
44
  attr_accessor :diagnostics_profile
42
45
 
43
- # @return [SubResource] the reference Id of the availability set to which
46
+ # @return [SubResource] The reference Id of the availability set to which
44
47
  # this virtual machine belongs.
45
48
  attr_accessor :availability_set
46
49
 
47
- # @return [String] the provisioning state, which only appears in the
50
+ # @return [String] The provisioning state, which only appears in the
48
51
  # response.
49
52
  attr_accessor :provisioning_state
50
53
 
51
- # @return [String] the license type, which is for bring your own license
54
+ # @return [String] The license type, which is for bring your own license
52
55
  # scenario.
53
56
  attr_accessor :license_type
54
57
 
@@ -56,7 +59,7 @@ module Azure::ARM::Compute
56
59
  # Marketplace images.
57
60
  attr_accessor :plan
58
61
 
59
- # @return [Array<VirtualMachineExtension>] the virtual machine child
62
+ # @return [Array<VirtualMachineExtension>] The virtual machine child
60
63
  # extension resources.
61
64
  attr_accessor :resources
62
65
 
@@ -143,6 +146,14 @@ module Azure::ARM::Compute
143
146
  name: 'Boolean'
144
147
  }
145
148
  },
149
+ vm_id: {
150
+ required: false,
151
+ read_only: true,
152
+ serialized_name: 'properties.vmId',
153
+ type: {
154
+ name: 'String'
155
+ }
156
+ },
146
157
  instance_view: {
147
158
  required: false,
148
159
  read_only: true,
@@ -12,10 +12,10 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [String] the extension name.
15
+ # @return [String] The extension name.
16
16
  attr_accessor :name
17
17
 
18
- # @return [Array<VirtualMachineStatusCodeCount>] the extensions
18
+ # @return [Array<VirtualMachineStatusCodeCount>] The extensions
19
19
  # information.
20
20
  attr_accessor :statuses_summary
21
21
 
@@ -12,7 +12,7 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [Array<String>] the virtual machine scale set instance ids.
15
+ # @return [Array<String>] The virtual machine scale set instance ids.
16
16
  attr_accessor :instance_ids
17
17
 
18
18
 
@@ -12,7 +12,7 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [Array<String>] the virtual machine scale set instance ids.
15
+ # @return [Array<String>] The virtual machine scale set instance ids.
16
16
  attr_accessor :instance_ids
17
17
 
18
18
 
@@ -12,32 +12,36 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [Integer] the Update Domain count.
15
+ # @return [Integer] The Update Domain count.
16
16
  attr_accessor :platform_update_domain
17
17
 
18
- # @return [Integer] the Fault Domain count.
18
+ # @return [Integer] The Fault Domain count.
19
19
  attr_accessor :platform_fault_domain
20
20
 
21
- # @return [String] the Remote desktop certificate thumbprint.
21
+ # @return [String] The Remote desktop certificate thumbprint.
22
22
  attr_accessor :rdp_thumb_print
23
23
 
24
- # @return [VirtualMachineAgentInstanceView] the VM Agent running on the
24
+ # @return [VirtualMachineAgentInstanceView] The VM Agent running on the
25
25
  # virtual machine.
26
26
  attr_accessor :vm_agent
27
27
 
28
- # @return [Array<DiskInstanceView>] the disks information.
28
+ # @return [Array<DiskInstanceView>] The disks information.
29
29
  attr_accessor :disks
30
30
 
31
- # @return [Array<VirtualMachineExtensionInstanceView>] the extensions
31
+ # @return [Array<VirtualMachineExtensionInstanceView>] The extensions
32
32
  # information.
33
33
  attr_accessor :extensions
34
34
 
35
- # @return [BootDiagnosticsInstanceView] the boot diagnostics.
35
+ # @return [BootDiagnosticsInstanceView] The boot diagnostics.
36
36
  attr_accessor :boot_diagnostics
37
37
 
38
- # @return [Array<InstanceViewStatus>] the resource status information.
38
+ # @return [Array<InstanceViewStatus>] The resource status information.
39
39
  attr_accessor :statuses
40
40
 
41
+ # @return [String] The placement group in which the VM is running. If the
42
+ # VM is deallocated it will not have a placementGroupId.
43
+ attr_accessor :placement_group_id
44
+
41
45
 
42
46
  #
43
47
  # Mapper for VirtualMachineScaleSetVMInstanceView class as Ruby Hash.
@@ -132,6 +136,13 @@ module Azure::ARM::Compute
132
136
  }
133
137
  }
134
138
  }
139
+ },
140
+ placement_group_id: {
141
+ required: false,
142
+ serialized_name: 'placementGroupId',
143
+ type: {
144
+ name: 'String'
145
+ }
135
146
  }
136
147
  }
137
148
  }
@@ -12,11 +12,11 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [Array<VirtualMachineScaleSetVM>] the list of virtual machine
15
+ # @return [Array<VirtualMachineScaleSetVM>] The list of virtual machine
16
16
  # scale sets VMs.
17
17
  attr_accessor :value
18
18
 
19
- # @return [String] the uri to fetch the next page of Virtual Machine
19
+ # @return [String] The uri to fetch the next page of Virtual Machine
20
20
  # Scale Set VMs. Call ListNext() with this to fetch the next page of VMSS
21
21
  # VMs
22
22
  attr_accessor :next_link
@@ -12,19 +12,19 @@ module Azure::ARM::Compute
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [VirtualMachineScaleSetOSProfile] the virtual machine scale set
15
+ # @return [VirtualMachineScaleSetOSProfile] The virtual machine scale set
16
16
  # OS profile.
17
17
  attr_accessor :os_profile
18
18
 
19
- # @return [VirtualMachineScaleSetStorageProfile] the virtual machine
19
+ # @return [VirtualMachineScaleSetStorageProfile] The virtual machine
20
20
  # scale set storage profile.
21
21
  attr_accessor :storage_profile
22
22
 
23
- # @return [VirtualMachineScaleSetNetworkProfile] the virtual machine
23
+ # @return [VirtualMachineScaleSetNetworkProfile] The virtual machine
24
24
  # scale set network profile.
25
25
  attr_accessor :network_profile
26
26
 
27
- # @return [VirtualMachineScaleSetExtensionProfile] the virtual machine
27
+ # @return [VirtualMachineScaleSetExtensionProfile] The virtual machine
28
28
  # scale set extension profile.
29
29
  attr_accessor :extension_profile
30
30
 
@@ -13,10 +13,10 @@ module Azure::ARM::Compute
13
13
 
14
14
  include MsRestAzure
15
15
 
16
- # @return [String] the instance view status code.
16
+ # @return [String] The instance view status code.
17
17
  attr_accessor :code
18
18
 
19
- # @return [Integer] the number of instances having a particular status
19
+ # @return [Integer] The number of instances having a particular status
20
20
  # code.
21
21
  attr_accessor :count
22
22
 
@@ -0,0 +1,1273 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Compute
7
+ #
8
+ # Composite Swagger for Compute Client
9
+ #
10
+ class Snapshots
11
+ include Azure::ARM::Compute::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Snapshots class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ComputeManagementClient] reference to the ComputeManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Creates or updates a snapshot.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param snapshot_name [String] The name of the snapshot within the given
30
+ # subscription and resource group.
31
+ # @param snapshot [Snapshot] Snapshot object supplied in the body of the Put
32
+ # disk operation.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [Snapshot] operation results.
37
+ #
38
+ def create_or_update(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
39
+ response = create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group.
45
+ # @param snapshot_name [String] The name of the snapshot within the given
46
+ # subscription and resource group.
47
+ # @param snapshot [Snapshot] Snapshot object supplied in the body of the Put
48
+ # disk operation.
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [Concurrent::Promise] promise which provides async access to http
53
+ # response.
54
+ #
55
+ def create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
56
+ # Send request
57
+ promise = begin_create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers)
58
+
59
+ promise = promise.then do |response|
60
+ # Defining deserialization method.
61
+ deserialize_method = lambda do |parsed_response|
62
+ result_mapper = Snapshot.mapper()
63
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
64
+ end
65
+
66
+ # Waiting for response.
67
+ @client.get_long_running_operation_result(response, deserialize_method)
68
+ end
69
+
70
+ promise
71
+ end
72
+
73
+ #
74
+ # Updates (patches) a snapshot.
75
+ #
76
+ # @param resource_group_name [String] The name of the resource group.
77
+ # @param snapshot_name [String] The name of the snapshot within the given
78
+ # subscription and resource group.
79
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
80
+ # Patch snapshot operation.
81
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
82
+ # will be added to the HTTP request.
83
+ #
84
+ # @return [Snapshot] operation results.
85
+ #
86
+ def update(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
87
+ response = update_async(resource_group_name, snapshot_name, snapshot, custom_headers).value!
88
+ response.body unless response.nil?
89
+ end
90
+
91
+ #
92
+ # @param resource_group_name [String] The name of the resource group.
93
+ # @param snapshot_name [String] The name of the snapshot within the given
94
+ # subscription and resource group.
95
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
96
+ # Patch snapshot operation.
97
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
98
+ # will be added to the HTTP request.
99
+ #
100
+ # @return [Concurrent::Promise] promise which provides async access to http
101
+ # response.
102
+ #
103
+ def update_async(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
104
+ # Send request
105
+ promise = begin_update_async(resource_group_name, snapshot_name, snapshot, custom_headers)
106
+
107
+ promise = promise.then do |response|
108
+ # Defining deserialization method.
109
+ deserialize_method = lambda do |parsed_response|
110
+ result_mapper = Snapshot.mapper()
111
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
112
+ end
113
+
114
+ # Waiting for response.
115
+ @client.get_long_running_operation_result(response, deserialize_method)
116
+ end
117
+
118
+ promise
119
+ end
120
+
121
+ #
122
+ # Gets information about a snapshot.
123
+ #
124
+ # @param resource_group_name [String] The name of the resource group.
125
+ # @param snapshot_name [String] The name of the snapshot within the given
126
+ # subscription and resource group.
127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
128
+ # will be added to the HTTP request.
129
+ #
130
+ # @return [Snapshot] operation results.
131
+ #
132
+ def get(resource_group_name, snapshot_name, custom_headers = nil)
133
+ response = get_async(resource_group_name, snapshot_name, custom_headers).value!
134
+ response.body unless response.nil?
135
+ end
136
+
137
+ #
138
+ # Gets information about a snapshot.
139
+ #
140
+ # @param resource_group_name [String] The name of the resource group.
141
+ # @param snapshot_name [String] The name of the snapshot within the given
142
+ # subscription and resource group.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
147
+ #
148
+ def get_with_http_info(resource_group_name, snapshot_name, custom_headers = nil)
149
+ get_async(resource_group_name, snapshot_name, custom_headers).value!
150
+ end
151
+
152
+ #
153
+ # Gets information about a snapshot.
154
+ #
155
+ # @param resource_group_name [String] The name of the resource group.
156
+ # @param snapshot_name [String] The name of the snapshot within the given
157
+ # subscription and resource group.
158
+ # @param [Hash{String => String}] A hash of custom headers that will be added
159
+ # to the HTTP request.
160
+ #
161
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
162
+ #
163
+ def get_async(resource_group_name, snapshot_name, custom_headers = nil)
164
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
165
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
166
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
167
+ api_version = '2016-04-30-preview'
168
+
169
+
170
+ request_headers = {}
171
+
172
+ # Set Headers
173
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
174
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
175
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'
176
+
177
+ request_url = @base_url || @client.base_url
178
+
179
+ options = {
180
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
181
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
182
+ query_params: {'api-version' => api_version},
183
+ headers: request_headers.merge(custom_headers || {}),
184
+ base_url: request_url
185
+ }
186
+ promise = @client.make_request_async(:get, path_template, options)
187
+
188
+ promise = promise.then do |result|
189
+ http_response = result.response
190
+ status_code = http_response.status
191
+ response_content = http_response.body
192
+ unless status_code == 200
193
+ error_model = JSON.load(response_content)
194
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
195
+ end
196
+
197
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
198
+ # Deserialize Response
199
+ if status_code == 200
200
+ begin
201
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
202
+ result_mapper = Snapshot.mapper()
203
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
204
+ rescue Exception => e
205
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
206
+ end
207
+ end
208
+
209
+ result
210
+ end
211
+
212
+ promise.execute
213
+ end
214
+
215
+ #
216
+ # Deletes a snapshot.
217
+ #
218
+ # @param resource_group_name [String] The name of the resource group.
219
+ # @param snapshot_name [String] The name of the snapshot within the given
220
+ # subscription and resource group.
221
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
222
+ # will be added to the HTTP request.
223
+ #
224
+ # @return [OperationStatusResponse] operation results.
225
+ #
226
+ def delete(resource_group_name, snapshot_name, custom_headers = nil)
227
+ response = delete_async(resource_group_name, snapshot_name, custom_headers).value!
228
+ response.body unless response.nil?
229
+ end
230
+
231
+ #
232
+ # @param resource_group_name [String] The name of the resource group.
233
+ # @param snapshot_name [String] The name of the snapshot within the given
234
+ # subscription and resource group.
235
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
236
+ # will be added to the HTTP request.
237
+ #
238
+ # @return [Concurrent::Promise] promise which provides async access to http
239
+ # response.
240
+ #
241
+ def delete_async(resource_group_name, snapshot_name, custom_headers = nil)
242
+ # Send request
243
+ promise = begin_delete_async(resource_group_name, snapshot_name, custom_headers)
244
+
245
+ promise = promise.then do |response|
246
+ # Defining deserialization method.
247
+ deserialize_method = lambda do |parsed_response|
248
+ result_mapper = OperationStatusResponse.mapper()
249
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
250
+ end
251
+
252
+ # Waiting for response.
253
+ @client.get_long_running_operation_result(response, deserialize_method)
254
+ end
255
+
256
+ promise
257
+ end
258
+
259
+ #
260
+ # Lists snapshots under a resource group.
261
+ #
262
+ # @param resource_group_name [String] The name of the resource group.
263
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
264
+ # will be added to the HTTP request.
265
+ #
266
+ # @return [Array<Snapshot>] operation results.
267
+ #
268
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
269
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
270
+ first_page.get_all_items
271
+ end
272
+
273
+ #
274
+ # Lists snapshots under a resource group.
275
+ #
276
+ # @param resource_group_name [String] The name of the resource group.
277
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
278
+ # will be added to the HTTP request.
279
+ #
280
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
281
+ #
282
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
283
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
284
+ end
285
+
286
+ #
287
+ # Lists snapshots under a resource group.
288
+ #
289
+ # @param resource_group_name [String] The name of the resource group.
290
+ # @param [Hash{String => String}] A hash of custom headers that will be added
291
+ # to the HTTP request.
292
+ #
293
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
294
+ #
295
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
296
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
297
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
298
+ api_version = '2016-04-30-preview'
299
+
300
+
301
+ request_headers = {}
302
+
303
+ # Set Headers
304
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
305
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
306
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'
307
+
308
+ request_url = @base_url || @client.base_url
309
+
310
+ options = {
311
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
312
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
313
+ query_params: {'api-version' => api_version},
314
+ headers: request_headers.merge(custom_headers || {}),
315
+ base_url: request_url
316
+ }
317
+ promise = @client.make_request_async(:get, path_template, options)
318
+
319
+ promise = promise.then do |result|
320
+ http_response = result.response
321
+ status_code = http_response.status
322
+ response_content = http_response.body
323
+ unless status_code == 200
324
+ error_model = JSON.load(response_content)
325
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
326
+ end
327
+
328
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
329
+ # Deserialize Response
330
+ if status_code == 200
331
+ begin
332
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
333
+ result_mapper = SnapshotList.mapper()
334
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
335
+ rescue Exception => e
336
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
337
+ end
338
+ end
339
+
340
+ result
341
+ end
342
+
343
+ promise.execute
344
+ end
345
+
346
+ #
347
+ # Lists snapshots under a subscription.
348
+ #
349
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
350
+ # will be added to the HTTP request.
351
+ #
352
+ # @return [Array<Snapshot>] operation results.
353
+ #
354
+ def list(custom_headers = nil)
355
+ first_page = list_as_lazy(custom_headers)
356
+ first_page.get_all_items
357
+ end
358
+
359
+ #
360
+ # Lists snapshots under a subscription.
361
+ #
362
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
363
+ # will be added to the HTTP request.
364
+ #
365
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
366
+ #
367
+ def list_with_http_info(custom_headers = nil)
368
+ list_async(custom_headers).value!
369
+ end
370
+
371
+ #
372
+ # Lists snapshots under a subscription.
373
+ #
374
+ # @param [Hash{String => String}] A hash of custom headers that will be added
375
+ # to the HTTP request.
376
+ #
377
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
378
+ #
379
+ def list_async(custom_headers = nil)
380
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
381
+ api_version = '2016-04-30-preview'
382
+
383
+
384
+ request_headers = {}
385
+
386
+ # Set Headers
387
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
388
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
389
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'
390
+
391
+ request_url = @base_url || @client.base_url
392
+
393
+ options = {
394
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
395
+ path_params: {'subscriptionId' => @client.subscription_id},
396
+ query_params: {'api-version' => api_version},
397
+ headers: request_headers.merge(custom_headers || {}),
398
+ base_url: request_url
399
+ }
400
+ promise = @client.make_request_async(:get, path_template, options)
401
+
402
+ promise = promise.then do |result|
403
+ http_response = result.response
404
+ status_code = http_response.status
405
+ response_content = http_response.body
406
+ unless status_code == 200
407
+ error_model = JSON.load(response_content)
408
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
409
+ end
410
+
411
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
412
+ # Deserialize Response
413
+ if status_code == 200
414
+ begin
415
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
416
+ result_mapper = SnapshotList.mapper()
417
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
418
+ rescue Exception => e
419
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
420
+ end
421
+ end
422
+
423
+ result
424
+ end
425
+
426
+ promise.execute
427
+ end
428
+
429
+ #
430
+ # Grants access to a snapshot.
431
+ #
432
+ # @param resource_group_name [String] The name of the resource group.
433
+ # @param snapshot_name [String] The name of the snapshot within the given
434
+ # subscription and resource group.
435
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
436
+ # body of the get snapshot access operation.
437
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
438
+ # will be added to the HTTP request.
439
+ #
440
+ # @return [AccessUri] operation results.
441
+ #
442
+ def grant_access(resource_group_name, snapshot_name, grant_access_data, custom_headers = nil)
443
+ response = grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers).value!
444
+ response.body unless response.nil?
445
+ end
446
+
447
+ #
448
+ # @param resource_group_name [String] The name of the resource group.
449
+ # @param snapshot_name [String] The name of the snapshot within the given
450
+ # subscription and resource group.
451
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
452
+ # body of the get snapshot access operation.
453
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
454
+ # will be added to the HTTP request.
455
+ #
456
+ # @return [Concurrent::Promise] promise which provides async access to http
457
+ # response.
458
+ #
459
+ def grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers = nil)
460
+ # Send request
461
+ promise = begin_grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers)
462
+
463
+ promise = promise.then do |response|
464
+ # Defining deserialization method.
465
+ deserialize_method = lambda do |parsed_response|
466
+ result_mapper = AccessUri.mapper()
467
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
468
+ end
469
+
470
+ # Waiting for response.
471
+ @client.get_long_running_operation_result(response, deserialize_method)
472
+ end
473
+
474
+ promise
475
+ end
476
+
477
+ #
478
+ # Revokes access to a snapshot.
479
+ #
480
+ # @param resource_group_name [String] The name of the resource group.
481
+ # @param snapshot_name [String] The name of the snapshot within the given
482
+ # subscription and resource group.
483
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
484
+ # will be added to the HTTP request.
485
+ #
486
+ # @return [OperationStatusResponse] operation results.
487
+ #
488
+ def revoke_access(resource_group_name, snapshot_name, custom_headers = nil)
489
+ response = revoke_access_async(resource_group_name, snapshot_name, custom_headers).value!
490
+ response.body unless response.nil?
491
+ end
492
+
493
+ #
494
+ # @param resource_group_name [String] The name of the resource group.
495
+ # @param snapshot_name [String] The name of the snapshot within the given
496
+ # subscription and resource group.
497
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
498
+ # will be added to the HTTP request.
499
+ #
500
+ # @return [Concurrent::Promise] promise which provides async access to http
501
+ # response.
502
+ #
503
+ def revoke_access_async(resource_group_name, snapshot_name, custom_headers = nil)
504
+ # Send request
505
+ promise = begin_revoke_access_async(resource_group_name, snapshot_name, custom_headers)
506
+
507
+ promise = promise.then do |response|
508
+ # Defining deserialization method.
509
+ deserialize_method = lambda do |parsed_response|
510
+ result_mapper = OperationStatusResponse.mapper()
511
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
512
+ end
513
+
514
+ # Waiting for response.
515
+ @client.get_long_running_operation_result(response, deserialize_method)
516
+ end
517
+
518
+ promise
519
+ end
520
+
521
+ #
522
+ # Creates or updates a snapshot.
523
+ #
524
+ # @param resource_group_name [String] The name of the resource group.
525
+ # @param snapshot_name [String] The name of the snapshot within the given
526
+ # subscription and resource group.
527
+ # @param snapshot [Snapshot] Snapshot object supplied in the body of the Put
528
+ # disk operation.
529
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
530
+ # will be added to the HTTP request.
531
+ #
532
+ # @return [Snapshot] operation results.
533
+ #
534
+ def begin_create_or_update(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
535
+ response = begin_create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers).value!
536
+ response.body unless response.nil?
537
+ end
538
+
539
+ #
540
+ # Creates or updates a snapshot.
541
+ #
542
+ # @param resource_group_name [String] The name of the resource group.
543
+ # @param snapshot_name [String] The name of the snapshot within the given
544
+ # subscription and resource group.
545
+ # @param snapshot [Snapshot] Snapshot object supplied in the body of the Put
546
+ # disk operation.
547
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
548
+ # will be added to the HTTP request.
549
+ #
550
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
551
+ #
552
+ def begin_create_or_update_with_http_info(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
553
+ begin_create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers).value!
554
+ end
555
+
556
+ #
557
+ # Creates or updates a snapshot.
558
+ #
559
+ # @param resource_group_name [String] The name of the resource group.
560
+ # @param snapshot_name [String] The name of the snapshot within the given
561
+ # subscription and resource group.
562
+ # @param snapshot [Snapshot] Snapshot object supplied in the body of the Put
563
+ # disk operation.
564
+ # @param [Hash{String => String}] A hash of custom headers that will be added
565
+ # to the HTTP request.
566
+ #
567
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
568
+ #
569
+ def begin_create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
570
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
571
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
572
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
573
+ api_version = '2016-04-30-preview'
574
+ fail ArgumentError, 'snapshot is nil' if snapshot.nil?
575
+
576
+
577
+ request_headers = {}
578
+
579
+ # Set Headers
580
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
581
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
582
+
583
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
584
+
585
+ # Serialize Request
586
+ request_mapper = Snapshot.mapper()
587
+ request_content = @client.serialize(request_mapper, snapshot, 'snapshot')
588
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
589
+
590
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'
591
+
592
+ request_url = @base_url || @client.base_url
593
+
594
+ options = {
595
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
596
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
597
+ query_params: {'api-version' => api_version},
598
+ body: request_content,
599
+ headers: request_headers.merge(custom_headers || {}),
600
+ base_url: request_url
601
+ }
602
+ promise = @client.make_request_async(:put, path_template, options)
603
+
604
+ promise = promise.then do |result|
605
+ http_response = result.response
606
+ status_code = http_response.status
607
+ response_content = http_response.body
608
+ unless status_code == 200 || status_code == 202
609
+ error_model = JSON.load(response_content)
610
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
611
+ end
612
+
613
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
614
+ # Deserialize Response
615
+ if status_code == 200
616
+ begin
617
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
618
+ result_mapper = Snapshot.mapper()
619
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
620
+ rescue Exception => e
621
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
622
+ end
623
+ end
624
+ # Deserialize Response
625
+ if status_code == 202
626
+ begin
627
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
628
+ result_mapper = Snapshot.mapper()
629
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
630
+ rescue Exception => e
631
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
632
+ end
633
+ end
634
+
635
+ result
636
+ end
637
+
638
+ promise.execute
639
+ end
640
+
641
+ #
642
+ # Updates (patches) a snapshot.
643
+ #
644
+ # @param resource_group_name [String] The name of the resource group.
645
+ # @param snapshot_name [String] The name of the snapshot within the given
646
+ # subscription and resource group.
647
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
648
+ # Patch snapshot operation.
649
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
650
+ # will be added to the HTTP request.
651
+ #
652
+ # @return [Snapshot] operation results.
653
+ #
654
+ def begin_update(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
655
+ response = begin_update_async(resource_group_name, snapshot_name, snapshot, custom_headers).value!
656
+ response.body unless response.nil?
657
+ end
658
+
659
+ #
660
+ # Updates (patches) a snapshot.
661
+ #
662
+ # @param resource_group_name [String] The name of the resource group.
663
+ # @param snapshot_name [String] The name of the snapshot within the given
664
+ # subscription and resource group.
665
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
666
+ # Patch snapshot operation.
667
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
668
+ # will be added to the HTTP request.
669
+ #
670
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
671
+ #
672
+ def begin_update_with_http_info(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
673
+ begin_update_async(resource_group_name, snapshot_name, snapshot, custom_headers).value!
674
+ end
675
+
676
+ #
677
+ # Updates (patches) a snapshot.
678
+ #
679
+ # @param resource_group_name [String] The name of the resource group.
680
+ # @param snapshot_name [String] The name of the snapshot within the given
681
+ # subscription and resource group.
682
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
683
+ # Patch snapshot operation.
684
+ # @param [Hash{String => String}] A hash of custom headers that will be added
685
+ # to the HTTP request.
686
+ #
687
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
688
+ #
689
+ def begin_update_async(resource_group_name, snapshot_name, snapshot, custom_headers = nil)
690
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
691
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
692
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
693
+ api_version = '2016-04-30-preview'
694
+ fail ArgumentError, 'snapshot is nil' if snapshot.nil?
695
+
696
+
697
+ request_headers = {}
698
+
699
+ # Set Headers
700
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
701
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
702
+
703
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
704
+
705
+ # Serialize Request
706
+ request_mapper = SnapshotUpdate.mapper()
707
+ request_content = @client.serialize(request_mapper, snapshot, 'snapshot')
708
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
709
+
710
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'
711
+
712
+ request_url = @base_url || @client.base_url
713
+
714
+ options = {
715
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
716
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
717
+ query_params: {'api-version' => api_version},
718
+ body: request_content,
719
+ headers: request_headers.merge(custom_headers || {}),
720
+ base_url: request_url
721
+ }
722
+ promise = @client.make_request_async(:patch, path_template, options)
723
+
724
+ promise = promise.then do |result|
725
+ http_response = result.response
726
+ status_code = http_response.status
727
+ response_content = http_response.body
728
+ unless status_code == 200 || status_code == 202
729
+ error_model = JSON.load(response_content)
730
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
731
+ end
732
+
733
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
734
+ # Deserialize Response
735
+ if status_code == 200
736
+ begin
737
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
738
+ result_mapper = Snapshot.mapper()
739
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
740
+ rescue Exception => e
741
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
742
+ end
743
+ end
744
+ # Deserialize Response
745
+ if status_code == 202
746
+ begin
747
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
748
+ result_mapper = Snapshot.mapper()
749
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
750
+ rescue Exception => e
751
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
752
+ end
753
+ end
754
+
755
+ result
756
+ end
757
+
758
+ promise.execute
759
+ end
760
+
761
+ #
762
+ # Deletes a snapshot.
763
+ #
764
+ # @param resource_group_name [String] The name of the resource group.
765
+ # @param snapshot_name [String] The name of the snapshot within the given
766
+ # subscription and resource group.
767
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
768
+ # will be added to the HTTP request.
769
+ #
770
+ # @return [OperationStatusResponse] operation results.
771
+ #
772
+ def begin_delete(resource_group_name, snapshot_name, custom_headers = nil)
773
+ response = begin_delete_async(resource_group_name, snapshot_name, custom_headers).value!
774
+ response.body unless response.nil?
775
+ end
776
+
777
+ #
778
+ # Deletes a snapshot.
779
+ #
780
+ # @param resource_group_name [String] The name of the resource group.
781
+ # @param snapshot_name [String] The name of the snapshot within the given
782
+ # subscription and resource group.
783
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
784
+ # will be added to the HTTP request.
785
+ #
786
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
787
+ #
788
+ def begin_delete_with_http_info(resource_group_name, snapshot_name, custom_headers = nil)
789
+ begin_delete_async(resource_group_name, snapshot_name, custom_headers).value!
790
+ end
791
+
792
+ #
793
+ # Deletes a snapshot.
794
+ #
795
+ # @param resource_group_name [String] The name of the resource group.
796
+ # @param snapshot_name [String] The name of the snapshot within the given
797
+ # subscription and resource group.
798
+ # @param [Hash{String => String}] A hash of custom headers that will be added
799
+ # to the HTTP request.
800
+ #
801
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
802
+ #
803
+ def begin_delete_async(resource_group_name, snapshot_name, custom_headers = nil)
804
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
805
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
806
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
807
+ api_version = '2016-04-30-preview'
808
+
809
+
810
+ request_headers = {}
811
+
812
+ # Set Headers
813
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
814
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
815
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'
816
+
817
+ request_url = @base_url || @client.base_url
818
+
819
+ options = {
820
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
821
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
822
+ query_params: {'api-version' => api_version},
823
+ headers: request_headers.merge(custom_headers || {}),
824
+ base_url: request_url
825
+ }
826
+ promise = @client.make_request_async(:delete, path_template, options)
827
+
828
+ promise = promise.then do |result|
829
+ http_response = result.response
830
+ status_code = http_response.status
831
+ response_content = http_response.body
832
+ unless status_code == 200 || status_code == 202 || status_code == 204
833
+ error_model = JSON.load(response_content)
834
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
835
+ end
836
+
837
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
838
+ # Deserialize Response
839
+ if status_code == 200
840
+ begin
841
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
842
+ result_mapper = OperationStatusResponse.mapper()
843
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
844
+ rescue Exception => e
845
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
846
+ end
847
+ end
848
+
849
+ result
850
+ end
851
+
852
+ promise.execute
853
+ end
854
+
855
+ #
856
+ # Grants access to a snapshot.
857
+ #
858
+ # @param resource_group_name [String] The name of the resource group.
859
+ # @param snapshot_name [String] The name of the snapshot within the given
860
+ # subscription and resource group.
861
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
862
+ # body of the get snapshot access operation.
863
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
864
+ # will be added to the HTTP request.
865
+ #
866
+ # @return [AccessUri] operation results.
867
+ #
868
+ def begin_grant_access(resource_group_name, snapshot_name, grant_access_data, custom_headers = nil)
869
+ response = begin_grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers).value!
870
+ response.body unless response.nil?
871
+ end
872
+
873
+ #
874
+ # Grants access to a snapshot.
875
+ #
876
+ # @param resource_group_name [String] The name of the resource group.
877
+ # @param snapshot_name [String] The name of the snapshot within the given
878
+ # subscription and resource group.
879
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
880
+ # body of the get snapshot access operation.
881
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
882
+ # will be added to the HTTP request.
883
+ #
884
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
885
+ #
886
+ def begin_grant_access_with_http_info(resource_group_name, snapshot_name, grant_access_data, custom_headers = nil)
887
+ begin_grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers).value!
888
+ end
889
+
890
+ #
891
+ # Grants access to a snapshot.
892
+ #
893
+ # @param resource_group_name [String] The name of the resource group.
894
+ # @param snapshot_name [String] The name of the snapshot within the given
895
+ # subscription and resource group.
896
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
897
+ # body of the get snapshot access operation.
898
+ # @param [Hash{String => String}] A hash of custom headers that will be added
899
+ # to the HTTP request.
900
+ #
901
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
902
+ #
903
+ def begin_grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers = nil)
904
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
905
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
906
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
907
+ api_version = '2016-04-30-preview'
908
+ fail ArgumentError, 'grant_access_data is nil' if grant_access_data.nil?
909
+
910
+
911
+ request_headers = {}
912
+
913
+ # Set Headers
914
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
915
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
916
+
917
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
918
+
919
+ # Serialize Request
920
+ request_mapper = GrantAccessData.mapper()
921
+ request_content = @client.serialize(request_mapper, grant_access_data, 'grant_access_data')
922
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
923
+
924
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'
925
+
926
+ request_url = @base_url || @client.base_url
927
+
928
+ options = {
929
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
930
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
931
+ query_params: {'api-version' => api_version},
932
+ body: request_content,
933
+ headers: request_headers.merge(custom_headers || {}),
934
+ base_url: request_url
935
+ }
936
+ promise = @client.make_request_async(:post, path_template, options)
937
+
938
+ promise = promise.then do |result|
939
+ http_response = result.response
940
+ status_code = http_response.status
941
+ response_content = http_response.body
942
+ unless status_code == 200 || status_code == 202
943
+ error_model = JSON.load(response_content)
944
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
945
+ end
946
+
947
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
948
+ # Deserialize Response
949
+ if status_code == 200
950
+ begin
951
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
952
+ result_mapper = AccessUri.mapper()
953
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
954
+ rescue Exception => e
955
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
956
+ end
957
+ end
958
+
959
+ result
960
+ end
961
+
962
+ promise.execute
963
+ end
964
+
965
+ #
966
+ # Revokes access to a snapshot.
967
+ #
968
+ # @param resource_group_name [String] The name of the resource group.
969
+ # @param snapshot_name [String] The name of the snapshot within the given
970
+ # subscription and resource group.
971
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
972
+ # will be added to the HTTP request.
973
+ #
974
+ # @return [OperationStatusResponse] operation results.
975
+ #
976
+ def begin_revoke_access(resource_group_name, snapshot_name, custom_headers = nil)
977
+ response = begin_revoke_access_async(resource_group_name, snapshot_name, custom_headers).value!
978
+ response.body unless response.nil?
979
+ end
980
+
981
+ #
982
+ # Revokes access to a snapshot.
983
+ #
984
+ # @param resource_group_name [String] The name of the resource group.
985
+ # @param snapshot_name [String] The name of the snapshot within the given
986
+ # subscription and resource group.
987
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
988
+ # will be added to the HTTP request.
989
+ #
990
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
991
+ #
992
+ def begin_revoke_access_with_http_info(resource_group_name, snapshot_name, custom_headers = nil)
993
+ begin_revoke_access_async(resource_group_name, snapshot_name, custom_headers).value!
994
+ end
995
+
996
+ #
997
+ # Revokes access to a snapshot.
998
+ #
999
+ # @param resource_group_name [String] The name of the resource group.
1000
+ # @param snapshot_name [String] The name of the snapshot within the given
1001
+ # subscription and resource group.
1002
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1003
+ # to the HTTP request.
1004
+ #
1005
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1006
+ #
1007
+ def begin_revoke_access_async(resource_group_name, snapshot_name, custom_headers = nil)
1008
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1009
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1010
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
1011
+ api_version = '2016-04-30-preview'
1012
+
1013
+
1014
+ request_headers = {}
1015
+
1016
+ # Set Headers
1017
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1018
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1019
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'
1020
+
1021
+ request_url = @base_url || @client.base_url
1022
+
1023
+ options = {
1024
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1025
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
1026
+ query_params: {'api-version' => api_version},
1027
+ headers: request_headers.merge(custom_headers || {}),
1028
+ base_url: request_url
1029
+ }
1030
+ promise = @client.make_request_async(:post, path_template, options)
1031
+
1032
+ promise = promise.then do |result|
1033
+ http_response = result.response
1034
+ status_code = http_response.status
1035
+ response_content = http_response.body
1036
+ unless status_code == 200 || status_code == 202
1037
+ error_model = JSON.load(response_content)
1038
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1039
+ end
1040
+
1041
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1042
+ # Deserialize Response
1043
+ if status_code == 200
1044
+ begin
1045
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1046
+ result_mapper = OperationStatusResponse.mapper()
1047
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1048
+ rescue Exception => e
1049
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1050
+ end
1051
+ end
1052
+
1053
+ result
1054
+ end
1055
+
1056
+ promise.execute
1057
+ end
1058
+
1059
+ #
1060
+ # Lists snapshots under a resource group.
1061
+ #
1062
+ # @param next_page_link [String] The NextLink from the previous successful call
1063
+ # to List operation.
1064
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1065
+ # will be added to the HTTP request.
1066
+ #
1067
+ # @return [SnapshotList] operation results.
1068
+ #
1069
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
1070
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
1071
+ response.body unless response.nil?
1072
+ end
1073
+
1074
+ #
1075
+ # Lists snapshots under a resource group.
1076
+ #
1077
+ # @param next_page_link [String] The NextLink from the previous successful call
1078
+ # to List operation.
1079
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1080
+ # will be added to the HTTP request.
1081
+ #
1082
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1083
+ #
1084
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
1085
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
1086
+ end
1087
+
1088
+ #
1089
+ # Lists snapshots under a resource group.
1090
+ #
1091
+ # @param next_page_link [String] The NextLink from the previous successful call
1092
+ # to List operation.
1093
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1094
+ # to the HTTP request.
1095
+ #
1096
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1097
+ #
1098
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
1099
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1100
+
1101
+
1102
+ request_headers = {}
1103
+
1104
+ # Set Headers
1105
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1106
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1107
+ path_template = '{nextLink}'
1108
+
1109
+ request_url = @base_url || @client.base_url
1110
+
1111
+ options = {
1112
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1113
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1114
+ headers: request_headers.merge(custom_headers || {}),
1115
+ base_url: request_url
1116
+ }
1117
+ promise = @client.make_request_async(:get, path_template, options)
1118
+
1119
+ promise = promise.then do |result|
1120
+ http_response = result.response
1121
+ status_code = http_response.status
1122
+ response_content = http_response.body
1123
+ unless status_code == 200
1124
+ error_model = JSON.load(response_content)
1125
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1126
+ end
1127
+
1128
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1129
+ # Deserialize Response
1130
+ if status_code == 200
1131
+ begin
1132
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1133
+ result_mapper = SnapshotList.mapper()
1134
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1135
+ rescue Exception => e
1136
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1137
+ end
1138
+ end
1139
+
1140
+ result
1141
+ end
1142
+
1143
+ promise.execute
1144
+ end
1145
+
1146
+ #
1147
+ # Lists snapshots under a subscription.
1148
+ #
1149
+ # @param next_page_link [String] The NextLink from the previous successful call
1150
+ # to List operation.
1151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1152
+ # will be added to the HTTP request.
1153
+ #
1154
+ # @return [SnapshotList] operation results.
1155
+ #
1156
+ def list_next(next_page_link, custom_headers = nil)
1157
+ response = list_next_async(next_page_link, custom_headers).value!
1158
+ response.body unless response.nil?
1159
+ end
1160
+
1161
+ #
1162
+ # Lists snapshots under a subscription.
1163
+ #
1164
+ # @param next_page_link [String] The NextLink from the previous successful call
1165
+ # to List operation.
1166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1167
+ # will be added to the HTTP request.
1168
+ #
1169
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1170
+ #
1171
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
1172
+ list_next_async(next_page_link, custom_headers).value!
1173
+ end
1174
+
1175
+ #
1176
+ # Lists snapshots under a subscription.
1177
+ #
1178
+ # @param next_page_link [String] The NextLink from the previous successful call
1179
+ # to List operation.
1180
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1181
+ # to the HTTP request.
1182
+ #
1183
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1184
+ #
1185
+ def list_next_async(next_page_link, custom_headers = nil)
1186
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1187
+
1188
+
1189
+ request_headers = {}
1190
+
1191
+ # Set Headers
1192
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1193
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1194
+ path_template = '{nextLink}'
1195
+
1196
+ request_url = @base_url || @client.base_url
1197
+
1198
+ options = {
1199
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1200
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1201
+ headers: request_headers.merge(custom_headers || {}),
1202
+ base_url: request_url
1203
+ }
1204
+ promise = @client.make_request_async(:get, path_template, options)
1205
+
1206
+ promise = promise.then do |result|
1207
+ http_response = result.response
1208
+ status_code = http_response.status
1209
+ response_content = http_response.body
1210
+ unless status_code == 200
1211
+ error_model = JSON.load(response_content)
1212
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1213
+ end
1214
+
1215
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1216
+ # Deserialize Response
1217
+ if status_code == 200
1218
+ begin
1219
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1220
+ result_mapper = SnapshotList.mapper()
1221
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1222
+ rescue Exception => e
1223
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1224
+ end
1225
+ end
1226
+
1227
+ result
1228
+ end
1229
+
1230
+ promise.execute
1231
+ end
1232
+
1233
+ #
1234
+ # Lists snapshots under a resource group.
1235
+ #
1236
+ # @param resource_group_name [String] The name of the resource group.
1237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1238
+ # will be added to the HTTP request.
1239
+ #
1240
+ # @return [SnapshotList] which provide lazy access to pages of the response.
1241
+ #
1242
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
1243
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
1244
+ unless response.nil?
1245
+ page = response.body
1246
+ page.next_method = Proc.new do |next_page_link|
1247
+ list_by_resource_group_next_async(next_page_link, custom_headers)
1248
+ end
1249
+ page
1250
+ end
1251
+ end
1252
+
1253
+ #
1254
+ # Lists snapshots under a subscription.
1255
+ #
1256
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1257
+ # will be added to the HTTP request.
1258
+ #
1259
+ # @return [SnapshotList] which provide lazy access to pages of the response.
1260
+ #
1261
+ def list_as_lazy(custom_headers = nil)
1262
+ response = list_async(custom_headers).value!
1263
+ unless response.nil?
1264
+ page = response.body
1265
+ page.next_method = Proc.new do |next_page_link|
1266
+ list_next_async(next_page_link, custom_headers)
1267
+ end
1268
+ page
1269
+ end
1270
+ end
1271
+
1272
+ end
1273
+ end