azure_mgmt_compute 0.18.1 → 0.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-06-15/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  3. data/lib/2015-06-15/generated/azure_mgmt_compute/models/data_disk.rb +1 -1
  4. data/lib/2015-06-15/generated/azure_mgmt_compute/models/osdisk.rb +1 -1
  5. data/lib/2016-03-30/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  6. data/lib/2016-03-30/generated/azure_mgmt_compute/models/data_disk.rb +1 -1
  7. data/lib/2016-03-30/generated/azure_mgmt_compute/models/osdisk.rb +1 -1
  8. data/lib/2016-04-30-preview/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  9. data/lib/2016-04-30-preview/generated/azure_mgmt_compute/models/data_disk.rb +1 -1
  10. data/lib/2016-04-30-preview/generated/azure_mgmt_compute/models/osdisk.rb +1 -1
  11. data/lib/2016-04-30-preview/generated/azure_mgmt_compute/models/virtual_machine_scale_set_data_disk.rb +1 -1
  12. data/lib/2017-03-30/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  13. data/lib/2017-03-30/generated/azure_mgmt_compute/models/data_disk.rb +1 -1
  14. data/lib/2017-03-30/generated/azure_mgmt_compute/models/osdisk.rb +1 -1
  15. data/lib/2017-03-30/generated/azure_mgmt_compute/models/virtual_machine_scale_set_data_disk.rb +1 -1
  16. data/lib/2017-09-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  17. data/lib/2017-12-01/generated/azure_mgmt_compute.rb +55 -55
  18. data/lib/2017-12-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  19. data/lib/2017-12-01/generated/azure_mgmt_compute/models/data_disk.rb +1 -1
  20. data/lib/2017-12-01/generated/azure_mgmt_compute/models/osdisk.rb +1 -1
  21. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine.rb +2 -3
  22. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_data_disk.rb +1 -1
  23. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vm.rb +3 -2
  24. data/lib/2017-12-01/generated/azure_mgmt_compute/models/virtual_machine_update.rb +2 -3
  25. data/lib/2018-04-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  26. data/lib/2018-04-01/generated/azure_mgmt_compute/models/access_uri.rb +1 -1
  27. data/lib/2018-04-01/generated/azure_mgmt_compute/models/data_disk.rb +1 -1
  28. data/lib/2018-04-01/generated/azure_mgmt_compute/models/osdisk.rb +1 -1
  29. data/lib/2018-06-01/generated/azure_mgmt_compute.rb +108 -85
  30. data/lib/2018-06-01/generated/azure_mgmt_compute/compute_management_client.rb +9 -1
  31. data/lib/2018-06-01/generated/azure_mgmt_compute/disks.rb +1274 -0
  32. data/lib/2018-06-01/generated/azure_mgmt_compute/models/{scale_tier.rb → access_level.rb} +4 -4
  33. data/lib/2018-06-01/generated/azure_mgmt_compute/models/access_uri.rb +47 -0
  34. data/lib/2018-06-01/generated/azure_mgmt_compute/models/additional_capabilities.rb +51 -0
  35. data/lib/2018-06-01/generated/azure_mgmt_compute/models/creation_data.rb +97 -0
  36. data/lib/2018-06-01/generated/azure_mgmt_compute/models/data_disk.rb +1 -1
  37. data/lib/2018-06-01/generated/azure_mgmt_compute/models/disk.rb +233 -0
  38. data/lib/2018-06-01/generated/azure_mgmt_compute/models/disk_create_option.rb +20 -0
  39. data/lib/2018-06-01/generated/azure_mgmt_compute/models/disk_list.rb +99 -0
  40. data/lib/2018-06-01/generated/azure_mgmt_compute/models/disk_sku.rb +62 -0
  41. data/lib/2018-06-01/generated/azure_mgmt_compute/models/disk_storage_account_types.rb +18 -0
  42. data/lib/2018-06-01/generated/azure_mgmt_compute/models/disk_update.rb +132 -0
  43. data/lib/2018-06-01/generated/azure_mgmt_compute/models/encryption_settings.rb +76 -0
  44. data/lib/2018-06-01/generated/azure_mgmt_compute/models/gallery_artifact_publishing_profile_base.rb +9 -8
  45. data/lib/2018-06-01/generated/azure_mgmt_compute/models/gallery_artifact_source.rb +1 -1
  46. data/lib/2018-06-01/generated/azure_mgmt_compute/models/gallery_image.rb +3 -3
  47. data/lib/2018-06-01/generated/azure_mgmt_compute/models/gallery_image_identifier.rb +3 -3
  48. data/lib/2018-06-01/generated/azure_mgmt_compute/models/gallery_image_version.rb +1 -1
  49. data/lib/2018-06-01/generated/azure_mgmt_compute/models/gallery_image_version_publishing_profile.rb +11 -11
  50. data/lib/2018-06-01/generated/azure_mgmt_compute/models/grant_access_data.rb +58 -0
  51. data/lib/2018-06-01/generated/azure_mgmt_compute/models/image_data_disk.rb +1 -1
  52. data/lib/2018-06-01/generated/azure_mgmt_compute/models/image_disk_reference.rb +60 -0
  53. data/lib/2018-06-01/generated/azure_mgmt_compute/models/image_osdisk.rb +1 -1
  54. data/lib/2018-06-01/generated/azure_mgmt_compute/models/key_vault_and_key_reference.rb +60 -0
  55. data/lib/2018-06-01/generated/azure_mgmt_compute/models/key_vault_and_secret_reference.rb +59 -0
  56. data/lib/2018-06-01/generated/azure_mgmt_compute/models/managed_artifact.rb +1 -1
  57. data/lib/2018-06-01/generated/azure_mgmt_compute/models/managed_disk_parameters.rb +3 -3
  58. data/lib/2018-06-01/generated/azure_mgmt_compute/models/osdisk.rb +1 -1
  59. data/lib/2018-06-01/generated/azure_mgmt_compute/models/snapshot.rb +187 -0
  60. data/lib/2018-06-01/generated/azure_mgmt_compute/models/snapshot_list.rb +99 -0
  61. data/lib/2018-06-01/generated/azure_mgmt_compute/models/snapshot_sku.rb +61 -0
  62. data/lib/2018-06-01/generated/azure_mgmt_compute/models/snapshot_storage_account_types.rb +17 -0
  63. data/lib/2018-06-01/generated/azure_mgmt_compute/models/snapshot_update.rb +106 -0
  64. data/lib/2018-06-01/generated/azure_mgmt_compute/models/source_vault.rb +47 -0
  65. data/lib/2018-06-01/generated/azure_mgmt_compute/models/storage_account_types.rb +1 -0
  66. data/lib/2018-06-01/generated/azure_mgmt_compute/models/target_region.rb +58 -0
  67. data/lib/2018-06-01/generated/azure_mgmt_compute/models/virtual_machine.rb +15 -0
  68. data/lib/2018-06-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_data_disk.rb +1 -1
  69. data/lib/2018-06-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_managed_disk_parameters.rb +1 -1
  70. data/lib/2018-06-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_osdisk.rb +14 -0
  71. data/lib/2018-06-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_public_ipaddress_configuration.rb +13 -0
  72. data/lib/2018-06-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update_osdisk.rb +14 -0
  73. data/lib/2018-06-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vm.rb +35 -0
  74. data/lib/2018-06-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmprofile.rb +15 -0
  75. data/lib/2018-06-01/generated/azure_mgmt_compute/models/virtual_machine_update.rb +15 -0
  76. data/lib/2018-06-01/generated/azure_mgmt_compute/snapshots.rb +1274 -0
  77. data/lib/2018-06-01/generated/azure_mgmt_compute/virtual_machine_scale_set_rolling_upgrades.rb +127 -0
  78. data/lib/2018-06-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb +12 -0
  79. data/lib/2018-06-01/generated/azure_mgmt_compute/virtual_machine_sizes.rb +6 -3
  80. data/lib/profiles/latest/modules/compute_profile_module.rb +360 -352
  81. data/lib/version.rb +1 -1
  82. metadata +26 -3
@@ -35,6 +35,12 @@ module Azure::Compute::Mgmt::V2018_06_01
35
35
  # Possible values include: 'FromImage', 'Empty', 'Attach'
36
36
  attr_accessor :create_option
37
37
 
38
+ # @return [Integer] Specifies the size of the operating system disk in
39
+ # gigabytes. This element can be used to overwrite the size of the disk
40
+ # in a virtual machine image. <br><br> This value cannot be larger than
41
+ # 1023 GB
42
+ attr_accessor :disk_size_gb
43
+
38
44
  # @return [OperatingSystemTypes] This property allows you to specify the
39
45
  # type of the OS that is included in the disk if creating a VM from
40
46
  # user-image or a specialized VHD. <br><br> Possible values are: <br><br>
@@ -101,6 +107,14 @@ module Azure::Compute::Mgmt::V2018_06_01
101
107
  name: 'String'
102
108
  }
103
109
  },
110
+ disk_size_gb: {
111
+ client_side_validation: true,
112
+ required: false,
113
+ serialized_name: 'diskSizeGB',
114
+ type: {
115
+ name: 'Number'
116
+ }
117
+ },
104
118
  os_type: {
105
119
  client_side_validation: true,
106
120
  required: false,
@@ -27,6 +27,10 @@ module Azure::Compute::Mgmt::V2018_06_01
27
27
  # associated with the public IP address.
28
28
  attr_accessor :ip_tags
29
29
 
30
+ # @return [SubResource] The PublicIPPrefix from which to allocate
31
+ # publicIP addresses.
32
+ attr_accessor :public_ipprefix
33
+
30
34
 
31
35
  #
32
36
  # Mapper for VirtualMachineScaleSetPublicIPAddressConfiguration class as
@@ -83,6 +87,15 @@ module Azure::Compute::Mgmt::V2018_06_01
83
87
  }
84
88
  }
85
89
  }
90
+ },
91
+ public_ipprefix: {
92
+ client_side_validation: true,
93
+ required: false,
94
+ serialized_name: 'properties.publicIPPrefix',
95
+ type: {
96
+ name: 'Composite',
97
+ class_name: 'SubResource'
98
+ }
86
99
  }
87
100
  }
88
101
  }
@@ -21,6 +21,12 @@ module Azure::Compute::Mgmt::V2018_06_01
21
21
  # or disabled on the disk.
22
22
  attr_accessor :write_accelerator_enabled
23
23
 
24
+ # @return [Integer] Specifies the size of the operating system disk in
25
+ # gigabytes. This element can be used to overwrite the size of the disk
26
+ # in a virtual machine image. <br><br> This value cannot be larger than
27
+ # 1023 GB
28
+ attr_accessor :disk_size_gb
29
+
24
30
  # @return [VirtualHardDisk] The Source User Image VirtualHardDisk. This
25
31
  # VirtualHardDisk will be copied before using it to attach to the Virtual
26
32
  # Machine. If SourceImage is provided, the destination VirtualHardDisk
@@ -65,6 +71,14 @@ module Azure::Compute::Mgmt::V2018_06_01
65
71
  name: 'Boolean'
66
72
  }
67
73
  },
74
+ disk_size_gb: {
75
+ client_side_validation: true,
76
+ required: false,
77
+ serialized_name: 'diskSizeGB',
78
+ type: {
79
+ name: 'Number'
80
+ }
81
+ },
68
82
  image: {
69
83
  client_side_validation: true,
70
84
  required: false,
@@ -37,6 +37,12 @@ module Azure::Compute::Mgmt::V2018_06_01
37
37
  # machine disks.
38
38
  attr_accessor :storage_profile
39
39
 
40
+ # @return [AdditionalCapabilities] Specifies additional capabilities
41
+ # enabled or disabled on the virtual machine in the scale set. For
42
+ # instance: whether the virtual machine has the capability to support
43
+ # attaching managed data disks with UltraSSD_LRS storage account type.
44
+ attr_accessor :additional_capabilities
45
+
40
46
  # @return [OSProfile] Specifies the operating system settings for the
41
47
  # virtual machine.
42
48
  attr_accessor :os_profile
@@ -90,6 +96,9 @@ module Azure::Compute::Mgmt::V2018_06_01
90
96
  # extension resources.
91
97
  attr_accessor :resources
92
98
 
99
+ # @return [Array<String>] The virtual machine zones.
100
+ attr_accessor :zones
101
+
93
102
 
94
103
  #
95
104
  # Mapper for VirtualMachineScaleSetVM class as Ruby Hash.
@@ -220,6 +229,15 @@ module Azure::Compute::Mgmt::V2018_06_01
220
229
  class_name: 'StorageProfile'
221
230
  }
222
231
  },
232
+ additional_capabilities: {
233
+ client_side_validation: true,
234
+ required: false,
235
+ serialized_name: 'properties.additionalCapabilities',
236
+ type: {
237
+ name: 'Composite',
238
+ class_name: 'AdditionalCapabilities'
239
+ }
240
+ },
223
241
  os_profile: {
224
242
  client_side_validation: true,
225
243
  required: false,
@@ -299,6 +317,23 @@ module Azure::Compute::Mgmt::V2018_06_01
299
317
  }
300
318
  }
301
319
  }
320
+ },
321
+ zones: {
322
+ client_side_validation: true,
323
+ required: false,
324
+ read_only: true,
325
+ serialized_name: 'zones',
326
+ type: {
327
+ name: 'Sequence',
328
+ element: {
329
+ client_side_validation: true,
330
+ required: false,
331
+ serialized_name: 'StringElementType',
332
+ type: {
333
+ name: 'String'
334
+ }
335
+ }
336
+ }
302
337
  }
303
338
  }
304
339
  }
@@ -20,6 +20,12 @@ module Azure::Compute::Mgmt::V2018_06_01
20
20
  # settings for the virtual machine disks.
21
21
  attr_accessor :storage_profile
22
22
 
23
+ # @return [AdditionalCapabilities] Specifies additional capabilities
24
+ # enabled or disabled on the virtual machine in the scale set. For
25
+ # instance: whether the virtual machine has the capability to support
26
+ # attaching managed data disks with UltraSSD_LRS storage account type.
27
+ attr_accessor :additional_capabilities
28
+
23
29
  # @return [VirtualMachineScaleSetNetworkProfile] Specifies properties of
24
30
  # the network interfaces of the virtual machines in the scale set.
25
31
  attr_accessor :network_profile
@@ -87,6 +93,15 @@ module Azure::Compute::Mgmt::V2018_06_01
87
93
  class_name: 'VirtualMachineScaleSetStorageProfile'
88
94
  }
89
95
  },
96
+ additional_capabilities: {
97
+ client_side_validation: true,
98
+ required: false,
99
+ serialized_name: 'additionalCapabilities',
100
+ type: {
101
+ name: 'Composite',
102
+ class_name: 'AdditionalCapabilities'
103
+ }
104
+ },
90
105
  network_profile: {
91
106
  client_side_validation: true,
92
107
  required: false,
@@ -29,6 +29,12 @@ module Azure::Compute::Mgmt::V2018_06_01
29
29
  # machine disks.
30
30
  attr_accessor :storage_profile
31
31
 
32
+ # @return [AdditionalCapabilities] Specifies additional capabilities
33
+ # enabled or disabled on the virtual machine. For instance: whether the
34
+ # virtual machine has the capability to support attaching managed data
35
+ # disks with UltraSSD_LRS storage account type.
36
+ attr_accessor :additional_capabilities
37
+
32
38
  # @return [OSProfile] Specifies the operating system settings for the
33
39
  # virtual machine.
34
40
  attr_accessor :os_profile
@@ -141,6 +147,15 @@ module Azure::Compute::Mgmt::V2018_06_01
141
147
  class_name: 'StorageProfile'
142
148
  }
143
149
  },
150
+ additional_capabilities: {
151
+ client_side_validation: true,
152
+ required: false,
153
+ serialized_name: 'properties.additionalCapabilities',
154
+ type: {
155
+ name: 'Composite',
156
+ class_name: 'AdditionalCapabilities'
157
+ }
158
+ },
144
159
  os_profile: {
145
160
  client_side_validation: true,
146
161
  required: false,
@@ -0,0 +1,1274 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Compute::Mgmt::V2018_06_01
7
+ #
8
+ # Compute Client
9
+ #
10
+ class Snapshots
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Snapshots class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ComputeManagementClient] reference to the ComputeManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Creates or updates a snapshot.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param snapshot_name [String] The name of the snapshot that is being created.
29
+ # The name can't be changed after the snapshot is created. Supported characters
30
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
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: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 that is being created.
46
+ # The name can't be changed after the snapshot is created. Supported characters
47
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
48
+ # @param snapshot [Snapshot] Snapshot object supplied in the body of the Put
49
+ # disk operation.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [Concurrent::Promise] promise which provides async access to http
54
+ # response.
55
+ #
56
+ def create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers:nil)
57
+ # Send request
58
+ promise = begin_create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers:custom_headers)
59
+
60
+ promise = promise.then do |response|
61
+ # Defining deserialization method.
62
+ deserialize_method = lambda do |parsed_response|
63
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::Snapshot.mapper()
64
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
65
+ end
66
+
67
+ # Waiting for response.
68
+ @client.get_long_running_operation_result(response, deserialize_method)
69
+ end
70
+
71
+ promise
72
+ end
73
+
74
+ #
75
+ # Updates (patches) a snapshot.
76
+ #
77
+ # @param resource_group_name [String] The name of the resource group.
78
+ # @param snapshot_name [String] The name of the snapshot that is being created.
79
+ # The name can't be changed after the snapshot is created. Supported characters
80
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
81
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
82
+ # Patch snapshot operation.
83
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
84
+ # will be added to the HTTP request.
85
+ #
86
+ # @return [Snapshot] operation results.
87
+ #
88
+ def update(resource_group_name, snapshot_name, snapshot, custom_headers:nil)
89
+ response = update_async(resource_group_name, snapshot_name, snapshot, custom_headers:custom_headers).value!
90
+ response.body unless response.nil?
91
+ end
92
+
93
+ #
94
+ # @param resource_group_name [String] The name of the resource group.
95
+ # @param snapshot_name [String] The name of the snapshot that is being created.
96
+ # The name can't be changed after the snapshot is created. Supported characters
97
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
98
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
99
+ # Patch snapshot operation.
100
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
101
+ # will be added to the HTTP request.
102
+ #
103
+ # @return [Concurrent::Promise] promise which provides async access to http
104
+ # response.
105
+ #
106
+ def update_async(resource_group_name, snapshot_name, snapshot, custom_headers:nil)
107
+ # Send request
108
+ promise = begin_update_async(resource_group_name, snapshot_name, snapshot, custom_headers:custom_headers)
109
+
110
+ promise = promise.then do |response|
111
+ # Defining deserialization method.
112
+ deserialize_method = lambda do |parsed_response|
113
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::Snapshot.mapper()
114
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
115
+ end
116
+
117
+ # Waiting for response.
118
+ @client.get_long_running_operation_result(response, deserialize_method)
119
+ end
120
+
121
+ promise
122
+ end
123
+
124
+ #
125
+ # Gets information about a snapshot.
126
+ #
127
+ # @param resource_group_name [String] The name of the resource group.
128
+ # @param snapshot_name [String] The name of the snapshot that is being created.
129
+ # The name can't be changed after the snapshot is created. Supported characters
130
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [Snapshot] operation results.
135
+ #
136
+ def get(resource_group_name, snapshot_name, custom_headers:nil)
137
+ response = get_async(resource_group_name, snapshot_name, custom_headers:custom_headers).value!
138
+ response.body unless response.nil?
139
+ end
140
+
141
+ #
142
+ # Gets information about a snapshot.
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group.
145
+ # @param snapshot_name [String] The name of the snapshot that is being created.
146
+ # The name can't be changed after the snapshot is created. Supported characters
147
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
152
+ #
153
+ def get_with_http_info(resource_group_name, snapshot_name, custom_headers:nil)
154
+ get_async(resource_group_name, snapshot_name, custom_headers:custom_headers).value!
155
+ end
156
+
157
+ #
158
+ # Gets information about a snapshot.
159
+ #
160
+ # @param resource_group_name [String] The name of the resource group.
161
+ # @param snapshot_name [String] The name of the snapshot that is being created.
162
+ # The name can't be changed after the snapshot is created. Supported characters
163
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
164
+ # @param [Hash{String => String}] A hash of custom headers that will be added
165
+ # to the HTTP request.
166
+ #
167
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
168
+ #
169
+ def get_async(resource_group_name, snapshot_name, custom_headers:nil)
170
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
171
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
172
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
173
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
174
+
175
+
176
+ request_headers = {}
177
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
178
+
179
+ # Set Headers
180
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
181
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
182
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'
183
+
184
+ request_url = @base_url || @client.base_url
185
+
186
+ options = {
187
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
188
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
189
+ query_params: {'api-version' => @client.api_version},
190
+ headers: request_headers.merge(custom_headers || {}),
191
+ base_url: request_url
192
+ }
193
+ promise = @client.make_request_async(:get, path_template, options)
194
+
195
+ promise = promise.then do |result|
196
+ http_response = result.response
197
+ status_code = http_response.status
198
+ response_content = http_response.body
199
+ unless status_code == 200
200
+ error_model = JSON.load(response_content)
201
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
202
+ end
203
+
204
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
205
+ # Deserialize Response
206
+ if status_code == 200
207
+ begin
208
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
209
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::Snapshot.mapper()
210
+ result.body = @client.deserialize(result_mapper, parsed_response)
211
+ rescue Exception => e
212
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
213
+ end
214
+ end
215
+
216
+ result
217
+ end
218
+
219
+ promise.execute
220
+ end
221
+
222
+ #
223
+ # Deletes a snapshot.
224
+ #
225
+ # @param resource_group_name [String] The name of the resource group.
226
+ # @param snapshot_name [String] The name of the snapshot that is being created.
227
+ # The name can't be changed after the snapshot is created. Supported characters
228
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
229
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
230
+ # will be added to the HTTP request.
231
+ #
232
+ def delete(resource_group_name, snapshot_name, custom_headers:nil)
233
+ response = delete_async(resource_group_name, snapshot_name, custom_headers:custom_headers).value!
234
+ nil
235
+ end
236
+
237
+ #
238
+ # @param resource_group_name [String] The name of the resource group.
239
+ # @param snapshot_name [String] The name of the snapshot that is being created.
240
+ # The name can't be changed after the snapshot is created. Supported characters
241
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
243
+ # will be added to the HTTP request.
244
+ #
245
+ # @return [Concurrent::Promise] promise which provides async access to http
246
+ # response.
247
+ #
248
+ def delete_async(resource_group_name, snapshot_name, custom_headers:nil)
249
+ # Send request
250
+ promise = begin_delete_async(resource_group_name, snapshot_name, custom_headers:custom_headers)
251
+
252
+ promise = promise.then do |response|
253
+ # Defining deserialization method.
254
+ deserialize_method = lambda do |parsed_response|
255
+ end
256
+
257
+ # Waiting for response.
258
+ @client.get_long_running_operation_result(response, deserialize_method)
259
+ end
260
+
261
+ promise
262
+ end
263
+
264
+ #
265
+ # Lists snapshots under a resource group.
266
+ #
267
+ # @param resource_group_name [String] The name of the resource group.
268
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
269
+ # will be added to the HTTP request.
270
+ #
271
+ # @return [Array<Snapshot>] operation results.
272
+ #
273
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
274
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
275
+ first_page.get_all_items
276
+ end
277
+
278
+ #
279
+ # Lists snapshots under a resource group.
280
+ #
281
+ # @param resource_group_name [String] The name of the resource group.
282
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
283
+ # will be added to the HTTP request.
284
+ #
285
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
286
+ #
287
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
288
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
289
+ end
290
+
291
+ #
292
+ # Lists snapshots under a resource group.
293
+ #
294
+ # @param resource_group_name [String] The name of the resource group.
295
+ # @param [Hash{String => String}] A hash of custom headers that will be added
296
+ # to the HTTP request.
297
+ #
298
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
299
+ #
300
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
301
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
302
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
303
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
304
+
305
+
306
+ request_headers = {}
307
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
308
+
309
+ # Set Headers
310
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
311
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
312
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'
313
+
314
+ request_url = @base_url || @client.base_url
315
+
316
+ options = {
317
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
318
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
319
+ query_params: {'api-version' => @client.api_version},
320
+ headers: request_headers.merge(custom_headers || {}),
321
+ base_url: request_url
322
+ }
323
+ promise = @client.make_request_async(:get, path_template, options)
324
+
325
+ promise = promise.then do |result|
326
+ http_response = result.response
327
+ status_code = http_response.status
328
+ response_content = http_response.body
329
+ unless status_code == 200
330
+ error_model = JSON.load(response_content)
331
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
332
+ end
333
+
334
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
335
+ # Deserialize Response
336
+ if status_code == 200
337
+ begin
338
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
339
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::SnapshotList.mapper()
340
+ result.body = @client.deserialize(result_mapper, parsed_response)
341
+ rescue Exception => e
342
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
343
+ end
344
+ end
345
+
346
+ result
347
+ end
348
+
349
+ promise.execute
350
+ end
351
+
352
+ #
353
+ # Lists snapshots under a subscription.
354
+ #
355
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
356
+ # will be added to the HTTP request.
357
+ #
358
+ # @return [Array<Snapshot>] operation results.
359
+ #
360
+ def list(custom_headers:nil)
361
+ first_page = list_as_lazy(custom_headers:custom_headers)
362
+ first_page.get_all_items
363
+ end
364
+
365
+ #
366
+ # Lists snapshots under a subscription.
367
+ #
368
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
369
+ # will be added to the HTTP request.
370
+ #
371
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
372
+ #
373
+ def list_with_http_info(custom_headers:nil)
374
+ list_async(custom_headers:custom_headers).value!
375
+ end
376
+
377
+ #
378
+ # Lists snapshots under a subscription.
379
+ #
380
+ # @param [Hash{String => String}] A hash of custom headers that will be added
381
+ # to the HTTP request.
382
+ #
383
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
384
+ #
385
+ def list_async(custom_headers:nil)
386
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
387
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
388
+
389
+
390
+ request_headers = {}
391
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
392
+
393
+ # Set Headers
394
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
395
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
396
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'
397
+
398
+ request_url = @base_url || @client.base_url
399
+
400
+ options = {
401
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
402
+ path_params: {'subscriptionId' => @client.subscription_id},
403
+ query_params: {'api-version' => @client.api_version},
404
+ headers: request_headers.merge(custom_headers || {}),
405
+ base_url: request_url
406
+ }
407
+ promise = @client.make_request_async(:get, path_template, options)
408
+
409
+ promise = promise.then do |result|
410
+ http_response = result.response
411
+ status_code = http_response.status
412
+ response_content = http_response.body
413
+ unless status_code == 200
414
+ error_model = JSON.load(response_content)
415
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
416
+ end
417
+
418
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
419
+ # Deserialize Response
420
+ if status_code == 200
421
+ begin
422
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
423
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::SnapshotList.mapper()
424
+ result.body = @client.deserialize(result_mapper, parsed_response)
425
+ rescue Exception => e
426
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
427
+ end
428
+ end
429
+
430
+ result
431
+ end
432
+
433
+ promise.execute
434
+ end
435
+
436
+ #
437
+ # Grants access to a snapshot.
438
+ #
439
+ # @param resource_group_name [String] The name of the resource group.
440
+ # @param snapshot_name [String] The name of the snapshot that is being created.
441
+ # The name can't be changed after the snapshot is created. Supported characters
442
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
443
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
444
+ # body of the get snapshot access operation.
445
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
446
+ # will be added to the HTTP request.
447
+ #
448
+ # @return [AccessUri] operation results.
449
+ #
450
+ def grant_access(resource_group_name, snapshot_name, grant_access_data, custom_headers:nil)
451
+ response = grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers:custom_headers).value!
452
+ response.body unless response.nil?
453
+ end
454
+
455
+ #
456
+ # @param resource_group_name [String] The name of the resource group.
457
+ # @param snapshot_name [String] The name of the snapshot that is being created.
458
+ # The name can't be changed after the snapshot is created. Supported characters
459
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
460
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
461
+ # body of the get snapshot access operation.
462
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
463
+ # will be added to the HTTP request.
464
+ #
465
+ # @return [Concurrent::Promise] promise which provides async access to http
466
+ # response.
467
+ #
468
+ def grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers:nil)
469
+ # Send request
470
+ promise = begin_grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers:custom_headers)
471
+
472
+ promise = promise.then do |response|
473
+ # Defining deserialization method.
474
+ deserialize_method = lambda do |parsed_response|
475
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::AccessUri.mapper()
476
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
477
+ end
478
+
479
+ # Waiting for response.
480
+ @client.get_long_running_operation_result(response, deserialize_method)
481
+ end
482
+
483
+ promise
484
+ end
485
+
486
+ #
487
+ # Revokes access to a snapshot.
488
+ #
489
+ # @param resource_group_name [String] The name of the resource group.
490
+ # @param snapshot_name [String] The name of the snapshot that is being created.
491
+ # The name can't be changed after the snapshot is created. Supported characters
492
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
493
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
494
+ # will be added to the HTTP request.
495
+ #
496
+ def revoke_access(resource_group_name, snapshot_name, custom_headers:nil)
497
+ response = revoke_access_async(resource_group_name, snapshot_name, custom_headers:custom_headers).value!
498
+ nil
499
+ end
500
+
501
+ #
502
+ # @param resource_group_name [String] The name of the resource group.
503
+ # @param snapshot_name [String] The name of the snapshot that is being created.
504
+ # The name can't be changed after the snapshot is created. Supported characters
505
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
506
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
507
+ # will be added to the HTTP request.
508
+ #
509
+ # @return [Concurrent::Promise] promise which provides async access to http
510
+ # response.
511
+ #
512
+ def revoke_access_async(resource_group_name, snapshot_name, custom_headers:nil)
513
+ # Send request
514
+ promise = begin_revoke_access_async(resource_group_name, snapshot_name, custom_headers:custom_headers)
515
+
516
+ promise = promise.then do |response|
517
+ # Defining deserialization method.
518
+ deserialize_method = lambda do |parsed_response|
519
+ end
520
+
521
+ # Waiting for response.
522
+ @client.get_long_running_operation_result(response, deserialize_method)
523
+ end
524
+
525
+ promise
526
+ end
527
+
528
+ #
529
+ # Creates or updates a snapshot.
530
+ #
531
+ # @param resource_group_name [String] The name of the resource group.
532
+ # @param snapshot_name [String] The name of the snapshot that is being created.
533
+ # The name can't be changed after the snapshot is created. Supported characters
534
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
535
+ # @param snapshot [Snapshot] Snapshot object supplied in the body of the Put
536
+ # disk operation.
537
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
538
+ # will be added to the HTTP request.
539
+ #
540
+ # @return [Snapshot] operation results.
541
+ #
542
+ def begin_create_or_update(resource_group_name, snapshot_name, snapshot, custom_headers:nil)
543
+ response = begin_create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers:custom_headers).value!
544
+ response.body unless response.nil?
545
+ end
546
+
547
+ #
548
+ # Creates or updates a snapshot.
549
+ #
550
+ # @param resource_group_name [String] The name of the resource group.
551
+ # @param snapshot_name [String] The name of the snapshot that is being created.
552
+ # The name can't be changed after the snapshot is created. Supported characters
553
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
554
+ # @param snapshot [Snapshot] Snapshot object supplied in the body of the Put
555
+ # disk operation.
556
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
557
+ # will be added to the HTTP request.
558
+ #
559
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
560
+ #
561
+ def begin_create_or_update_with_http_info(resource_group_name, snapshot_name, snapshot, custom_headers:nil)
562
+ begin_create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers:custom_headers).value!
563
+ end
564
+
565
+ #
566
+ # Creates or updates a snapshot.
567
+ #
568
+ # @param resource_group_name [String] The name of the resource group.
569
+ # @param snapshot_name [String] The name of the snapshot that is being created.
570
+ # The name can't be changed after the snapshot is created. Supported characters
571
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
572
+ # @param snapshot [Snapshot] Snapshot object supplied in the body of the Put
573
+ # disk operation.
574
+ # @param [Hash{String => String}] A hash of custom headers that will be added
575
+ # to the HTTP request.
576
+ #
577
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
578
+ #
579
+ def begin_create_or_update_async(resource_group_name, snapshot_name, snapshot, custom_headers:nil)
580
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
581
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
582
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
583
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
584
+ fail ArgumentError, 'snapshot is nil' if snapshot.nil?
585
+
586
+
587
+ request_headers = {}
588
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
589
+
590
+ # Set Headers
591
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
592
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
593
+
594
+ # Serialize Request
595
+ request_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::Snapshot.mapper()
596
+ request_content = @client.serialize(request_mapper, snapshot)
597
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
598
+
599
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'
600
+
601
+ request_url = @base_url || @client.base_url
602
+
603
+ options = {
604
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
605
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
606
+ query_params: {'api-version' => @client.api_version},
607
+ body: request_content,
608
+ headers: request_headers.merge(custom_headers || {}),
609
+ base_url: request_url
610
+ }
611
+ promise = @client.make_request_async(:put, path_template, options)
612
+
613
+ promise = promise.then do |result|
614
+ http_response = result.response
615
+ status_code = http_response.status
616
+ response_content = http_response.body
617
+ unless status_code == 200 || status_code == 202
618
+ error_model = JSON.load(response_content)
619
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
620
+ end
621
+
622
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
623
+ # Deserialize Response
624
+ if status_code == 200
625
+ begin
626
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
627
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::Snapshot.mapper()
628
+ result.body = @client.deserialize(result_mapper, parsed_response)
629
+ rescue Exception => e
630
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
631
+ end
632
+ end
633
+ # Deserialize Response
634
+ if status_code == 202
635
+ begin
636
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
637
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::Snapshot.mapper()
638
+ result.body = @client.deserialize(result_mapper, parsed_response)
639
+ rescue Exception => e
640
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
641
+ end
642
+ end
643
+
644
+ result
645
+ end
646
+
647
+ promise.execute
648
+ end
649
+
650
+ #
651
+ # Updates (patches) a snapshot.
652
+ #
653
+ # @param resource_group_name [String] The name of the resource group.
654
+ # @param snapshot_name [String] The name of the snapshot that is being created.
655
+ # The name can't be changed after the snapshot is created. Supported characters
656
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
657
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
658
+ # Patch snapshot operation.
659
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
660
+ # will be added to the HTTP request.
661
+ #
662
+ # @return [Snapshot] operation results.
663
+ #
664
+ def begin_update(resource_group_name, snapshot_name, snapshot, custom_headers:nil)
665
+ response = begin_update_async(resource_group_name, snapshot_name, snapshot, custom_headers:custom_headers).value!
666
+ response.body unless response.nil?
667
+ end
668
+
669
+ #
670
+ # Updates (patches) a snapshot.
671
+ #
672
+ # @param resource_group_name [String] The name of the resource group.
673
+ # @param snapshot_name [String] The name of the snapshot that is being created.
674
+ # The name can't be changed after the snapshot is created. Supported characters
675
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
676
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
677
+ # Patch snapshot operation.
678
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
679
+ # will be added to the HTTP request.
680
+ #
681
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
682
+ #
683
+ def begin_update_with_http_info(resource_group_name, snapshot_name, snapshot, custom_headers:nil)
684
+ begin_update_async(resource_group_name, snapshot_name, snapshot, custom_headers:custom_headers).value!
685
+ end
686
+
687
+ #
688
+ # Updates (patches) a snapshot.
689
+ #
690
+ # @param resource_group_name [String] The name of the resource group.
691
+ # @param snapshot_name [String] The name of the snapshot that is being created.
692
+ # The name can't be changed after the snapshot is created. Supported characters
693
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
694
+ # @param snapshot [SnapshotUpdate] Snapshot object supplied in the body of the
695
+ # Patch snapshot operation.
696
+ # @param [Hash{String => String}] A hash of custom headers that will be added
697
+ # to the HTTP request.
698
+ #
699
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
700
+ #
701
+ def begin_update_async(resource_group_name, snapshot_name, snapshot, custom_headers:nil)
702
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
703
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
704
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
705
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
706
+ fail ArgumentError, 'snapshot is nil' if snapshot.nil?
707
+
708
+
709
+ request_headers = {}
710
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
711
+
712
+ # Set Headers
713
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
714
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
715
+
716
+ # Serialize Request
717
+ request_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::SnapshotUpdate.mapper()
718
+ request_content = @client.serialize(request_mapper, snapshot)
719
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
720
+
721
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'
722
+
723
+ request_url = @base_url || @client.base_url
724
+
725
+ options = {
726
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
727
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
728
+ query_params: {'api-version' => @client.api_version},
729
+ body: request_content,
730
+ headers: request_headers.merge(custom_headers || {}),
731
+ base_url: request_url
732
+ }
733
+ promise = @client.make_request_async(:patch, path_template, options)
734
+
735
+ promise = promise.then do |result|
736
+ http_response = result.response
737
+ status_code = http_response.status
738
+ response_content = http_response.body
739
+ unless status_code == 200 || status_code == 202
740
+ error_model = JSON.load(response_content)
741
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
742
+ end
743
+
744
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
745
+ # Deserialize Response
746
+ if status_code == 200
747
+ begin
748
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
749
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::Snapshot.mapper()
750
+ result.body = @client.deserialize(result_mapper, parsed_response)
751
+ rescue Exception => e
752
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
753
+ end
754
+ end
755
+ # Deserialize Response
756
+ if status_code == 202
757
+ begin
758
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
759
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::Snapshot.mapper()
760
+ result.body = @client.deserialize(result_mapper, parsed_response)
761
+ rescue Exception => e
762
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
763
+ end
764
+ end
765
+
766
+ result
767
+ end
768
+
769
+ promise.execute
770
+ end
771
+
772
+ #
773
+ # Deletes a snapshot.
774
+ #
775
+ # @param resource_group_name [String] The name of the resource group.
776
+ # @param snapshot_name [String] The name of the snapshot that is being created.
777
+ # The name can't be changed after the snapshot is created. Supported characters
778
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
779
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
780
+ # will be added to the HTTP request.
781
+ #
782
+ #
783
+ def begin_delete(resource_group_name, snapshot_name, custom_headers:nil)
784
+ response = begin_delete_async(resource_group_name, snapshot_name, custom_headers:custom_headers).value!
785
+ nil
786
+ end
787
+
788
+ #
789
+ # Deletes a snapshot.
790
+ #
791
+ # @param resource_group_name [String] The name of the resource group.
792
+ # @param snapshot_name [String] The name of the snapshot that is being created.
793
+ # The name can't be changed after the snapshot is created. Supported characters
794
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
795
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
796
+ # will be added to the HTTP request.
797
+ #
798
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
799
+ #
800
+ def begin_delete_with_http_info(resource_group_name, snapshot_name, custom_headers:nil)
801
+ begin_delete_async(resource_group_name, snapshot_name, custom_headers:custom_headers).value!
802
+ end
803
+
804
+ #
805
+ # Deletes a snapshot.
806
+ #
807
+ # @param resource_group_name [String] The name of the resource group.
808
+ # @param snapshot_name [String] The name of the snapshot that is being created.
809
+ # The name can't be changed after the snapshot is created. Supported characters
810
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
811
+ # @param [Hash{String => String}] A hash of custom headers that will be added
812
+ # to the HTTP request.
813
+ #
814
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
815
+ #
816
+ def begin_delete_async(resource_group_name, snapshot_name, custom_headers:nil)
817
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
818
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
819
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
820
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
821
+
822
+
823
+ request_headers = {}
824
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
825
+
826
+ # Set Headers
827
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
828
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
829
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'
830
+
831
+ request_url = @base_url || @client.base_url
832
+
833
+ options = {
834
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
835
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
836
+ query_params: {'api-version' => @client.api_version},
837
+ headers: request_headers.merge(custom_headers || {}),
838
+ base_url: request_url
839
+ }
840
+ promise = @client.make_request_async(:delete, path_template, options)
841
+
842
+ promise = promise.then do |result|
843
+ http_response = result.response
844
+ status_code = http_response.status
845
+ response_content = http_response.body
846
+ unless status_code == 200 || status_code == 202 || status_code == 204
847
+ error_model = JSON.load(response_content)
848
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
849
+ end
850
+
851
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
852
+
853
+ result
854
+ end
855
+
856
+ promise.execute
857
+ end
858
+
859
+ #
860
+ # Grants access to a snapshot.
861
+ #
862
+ # @param resource_group_name [String] The name of the resource group.
863
+ # @param snapshot_name [String] The name of the snapshot that is being created.
864
+ # The name can't be changed after the snapshot is created. Supported characters
865
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
866
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
867
+ # body of the get snapshot access operation.
868
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
869
+ # will be added to the HTTP request.
870
+ #
871
+ # @return [AccessUri] operation results.
872
+ #
873
+ def begin_grant_access(resource_group_name, snapshot_name, grant_access_data, custom_headers:nil)
874
+ response = begin_grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers:custom_headers).value!
875
+ response.body unless response.nil?
876
+ end
877
+
878
+ #
879
+ # Grants access to a snapshot.
880
+ #
881
+ # @param resource_group_name [String] The name of the resource group.
882
+ # @param snapshot_name [String] The name of the snapshot that is being created.
883
+ # The name can't be changed after the snapshot is created. Supported characters
884
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
885
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
886
+ # body of the get snapshot access operation.
887
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
888
+ # will be added to the HTTP request.
889
+ #
890
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
891
+ #
892
+ def begin_grant_access_with_http_info(resource_group_name, snapshot_name, grant_access_data, custom_headers:nil)
893
+ begin_grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers:custom_headers).value!
894
+ end
895
+
896
+ #
897
+ # Grants access to a snapshot.
898
+ #
899
+ # @param resource_group_name [String] The name of the resource group.
900
+ # @param snapshot_name [String] The name of the snapshot that is being created.
901
+ # The name can't be changed after the snapshot is created. Supported characters
902
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
903
+ # @param grant_access_data [GrantAccessData] Access data object supplied in the
904
+ # body of the get snapshot access operation.
905
+ # @param [Hash{String => String}] A hash of custom headers that will be added
906
+ # to the HTTP request.
907
+ #
908
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
909
+ #
910
+ def begin_grant_access_async(resource_group_name, snapshot_name, grant_access_data, custom_headers:nil)
911
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
912
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
913
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
914
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
915
+ fail ArgumentError, 'grant_access_data is nil' if grant_access_data.nil?
916
+
917
+
918
+ request_headers = {}
919
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
920
+
921
+ # Set Headers
922
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
923
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
924
+
925
+ # Serialize Request
926
+ request_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::GrantAccessData.mapper()
927
+ request_content = @client.serialize(request_mapper, grant_access_data)
928
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
929
+
930
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'
931
+
932
+ request_url = @base_url || @client.base_url
933
+
934
+ options = {
935
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
936
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
937
+ query_params: {'api-version' => @client.api_version},
938
+ body: request_content,
939
+ headers: request_headers.merge(custom_headers || {}),
940
+ base_url: request_url
941
+ }
942
+ promise = @client.make_request_async(:post, path_template, options)
943
+
944
+ promise = promise.then do |result|
945
+ http_response = result.response
946
+ status_code = http_response.status
947
+ response_content = http_response.body
948
+ unless status_code == 200 || status_code == 202
949
+ error_model = JSON.load(response_content)
950
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
951
+ end
952
+
953
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
954
+ # Deserialize Response
955
+ if status_code == 200
956
+ begin
957
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
958
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::AccessUri.mapper()
959
+ result.body = @client.deserialize(result_mapper, parsed_response)
960
+ rescue Exception => e
961
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
962
+ end
963
+ end
964
+
965
+ result
966
+ end
967
+
968
+ promise.execute
969
+ end
970
+
971
+ #
972
+ # Revokes access to a snapshot.
973
+ #
974
+ # @param resource_group_name [String] The name of the resource group.
975
+ # @param snapshot_name [String] The name of the snapshot that is being created.
976
+ # The name can't be changed after the snapshot is created. Supported characters
977
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
978
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
979
+ # will be added to the HTTP request.
980
+ #
981
+ #
982
+ def begin_revoke_access(resource_group_name, snapshot_name, custom_headers:nil)
983
+ response = begin_revoke_access_async(resource_group_name, snapshot_name, custom_headers:custom_headers).value!
984
+ nil
985
+ end
986
+
987
+ #
988
+ # Revokes access to a snapshot.
989
+ #
990
+ # @param resource_group_name [String] The name of the resource group.
991
+ # @param snapshot_name [String] The name of the snapshot that is being created.
992
+ # The name can't be changed after the snapshot is created. Supported characters
993
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
994
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
995
+ # will be added to the HTTP request.
996
+ #
997
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
998
+ #
999
+ def begin_revoke_access_with_http_info(resource_group_name, snapshot_name, custom_headers:nil)
1000
+ begin_revoke_access_async(resource_group_name, snapshot_name, custom_headers:custom_headers).value!
1001
+ end
1002
+
1003
+ #
1004
+ # Revokes access to a snapshot.
1005
+ #
1006
+ # @param resource_group_name [String] The name of the resource group.
1007
+ # @param snapshot_name [String] The name of the snapshot that is being created.
1008
+ # The name can't be changed after the snapshot is created. Supported characters
1009
+ # for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
1010
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1011
+ # to the HTTP request.
1012
+ #
1013
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1014
+ #
1015
+ def begin_revoke_access_async(resource_group_name, snapshot_name, custom_headers:nil)
1016
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1017
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1018
+ fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
1019
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1020
+
1021
+
1022
+ request_headers = {}
1023
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1024
+
1025
+ # Set Headers
1026
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1027
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1028
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'
1029
+
1030
+ request_url = @base_url || @client.base_url
1031
+
1032
+ options = {
1033
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1034
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'snapshotName' => snapshot_name},
1035
+ query_params: {'api-version' => @client.api_version},
1036
+ headers: request_headers.merge(custom_headers || {}),
1037
+ base_url: request_url
1038
+ }
1039
+ promise = @client.make_request_async(:post, path_template, options)
1040
+
1041
+ promise = promise.then do |result|
1042
+ http_response = result.response
1043
+ status_code = http_response.status
1044
+ response_content = http_response.body
1045
+ unless status_code == 200 || status_code == 202
1046
+ error_model = JSON.load(response_content)
1047
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1048
+ end
1049
+
1050
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1051
+
1052
+ result
1053
+ end
1054
+
1055
+ promise.execute
1056
+ end
1057
+
1058
+ #
1059
+ # Lists snapshots under a resource group.
1060
+ #
1061
+ # @param next_page_link [String] The NextLink from the previous successful call
1062
+ # to List operation.
1063
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1064
+ # will be added to the HTTP request.
1065
+ #
1066
+ # @return [SnapshotList] operation results.
1067
+ #
1068
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
1069
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1070
+ response.body unless response.nil?
1071
+ end
1072
+
1073
+ #
1074
+ # Lists snapshots under a resource group.
1075
+ #
1076
+ # @param next_page_link [String] The NextLink from the previous successful call
1077
+ # to List operation.
1078
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1079
+ # will be added to the HTTP request.
1080
+ #
1081
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1082
+ #
1083
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
1084
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1085
+ end
1086
+
1087
+ #
1088
+ # Lists snapshots under a resource group.
1089
+ #
1090
+ # @param next_page_link [String] The NextLink from the previous successful call
1091
+ # to List operation.
1092
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1093
+ # to the HTTP request.
1094
+ #
1095
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1096
+ #
1097
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
1098
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1099
+
1100
+
1101
+ request_headers = {}
1102
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
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 = Azure::Compute::Mgmt::V2018_06_01::Models::SnapshotList.mapper()
1134
+ result.body = @client.deserialize(result_mapper, parsed_response)
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: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: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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1191
+
1192
+ # Set Headers
1193
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1194
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1195
+ path_template = '{nextLink}'
1196
+
1197
+ request_url = @base_url || @client.base_url
1198
+
1199
+ options = {
1200
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1201
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1202
+ headers: request_headers.merge(custom_headers || {}),
1203
+ base_url: request_url
1204
+ }
1205
+ promise = @client.make_request_async(:get, path_template, options)
1206
+
1207
+ promise = promise.then do |result|
1208
+ http_response = result.response
1209
+ status_code = http_response.status
1210
+ response_content = http_response.body
1211
+ unless status_code == 200
1212
+ error_model = JSON.load(response_content)
1213
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1214
+ end
1215
+
1216
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1217
+ # Deserialize Response
1218
+ if status_code == 200
1219
+ begin
1220
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1221
+ result_mapper = Azure::Compute::Mgmt::V2018_06_01::Models::SnapshotList.mapper()
1222
+ result.body = @client.deserialize(result_mapper, parsed_response)
1223
+ rescue Exception => e
1224
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1225
+ end
1226
+ end
1227
+
1228
+ result
1229
+ end
1230
+
1231
+ promise.execute
1232
+ end
1233
+
1234
+ #
1235
+ # Lists snapshots under a resource group.
1236
+ #
1237
+ # @param resource_group_name [String] The name of the resource group.
1238
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1239
+ # will be added to the HTTP request.
1240
+ #
1241
+ # @return [SnapshotList] which provide lazy access to pages of the response.
1242
+ #
1243
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
1244
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
1245
+ unless response.nil?
1246
+ page = response.body
1247
+ page.next_method = Proc.new do |next_page_link|
1248
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1249
+ end
1250
+ page
1251
+ end
1252
+ end
1253
+
1254
+ #
1255
+ # Lists snapshots under a subscription.
1256
+ #
1257
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1258
+ # will be added to the HTTP request.
1259
+ #
1260
+ # @return [SnapshotList] which provide lazy access to pages of the response.
1261
+ #
1262
+ def list_as_lazy(custom_headers:nil)
1263
+ response = list_async(custom_headers:custom_headers).value!
1264
+ unless response.nil?
1265
+ page = response.body
1266
+ page.next_method = Proc.new do |next_page_link|
1267
+ list_next_async(next_page_link, custom_headers:custom_headers)
1268
+ end
1269
+ page
1270
+ end
1271
+ end
1272
+
1273
+ end
1274
+ end