azure_mgmt_sqlvirtualmachine 0.17.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 (56) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine.rb +71 -0
  4. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/availability_group_listeners.rb +684 -0
  5. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/additional_features_server_configurations.rb +57 -0
  6. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/auto_backup_settings.rb +173 -0
  7. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/auto_patching_settings.rb +85 -0
  8. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/availability_group_listener.rb +130 -0
  9. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/availability_group_listener_list_result.rb +100 -0
  10. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/backup_schedule_type.rb +16 -0
  11. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/cluster_configuration.rb +15 -0
  12. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/cluster_manager_type.rb +15 -0
  13. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/connectivity_type.rb +17 -0
  14. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/day_of_week.rb +21 -0
  15. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/disk_configuration_type.rb +17 -0
  16. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/full_backup_frequency_type.rb +16 -0
  17. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/identity_type.rb +15 -0
  18. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/key_vault_credential_settings.rb +91 -0
  19. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/load_balancer_configuration.rb +100 -0
  20. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/operation.rb +95 -0
  21. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/operation_display.rb +85 -0
  22. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/operation_list_result.rb +100 -0
  23. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/operation_origin.rb +16 -0
  24. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/private_ipaddress.rb +58 -0
  25. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/proxy_resource.rb +62 -0
  26. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/resource.rb +80 -0
  27. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/resource_identity.rb +72 -0
  28. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/scale_type.rb +15 -0
  29. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/server_configurations_management_settings.rb +84 -0
  30. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_connectivity_update_settings.rb +80 -0
  31. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_image_sku.rb +19 -0
  32. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_server_license_type.rb +16 -0
  33. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_storage_update_settings.rb +58 -0
  34. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine.rb +237 -0
  35. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_group.rb +174 -0
  36. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_group_list_result.rb +100 -0
  37. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_group_update.rb +54 -0
  38. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_list_result.rb +100 -0
  39. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_update.rb +54 -0
  40. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_workload_type.rb +17 -0
  41. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_workload_type_update_settings.rb +47 -0
  42. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/tracked_resource.rb +92 -0
  43. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/wsfc_domain_credentials.rb +69 -0
  44. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/wsfc_domain_profile.rb +130 -0
  45. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/module_definition.rb +9 -0
  46. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/operations.rb +219 -0
  47. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/sql_virtual_machine_groups.rb +1000 -0
  48. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/sql_virtual_machine_management_client.rb +143 -0
  49. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/sql_virtual_machines.rb +980 -0
  50. data/lib/azure_mgmt_sqlvirtualmachine.rb +6 -0
  51. data/lib/module_definition.rb +8 -0
  52. data/lib/profiles/latest/modules/sqlvirtualmachine_profile_module.rb +227 -0
  53. data/lib/profiles/latest/sqlvirtualmachine_latest_profile_client.rb +40 -0
  54. data/lib/profiles/latest/sqlvirtualmachine_module_definition.rb +8 -0
  55. data/lib/version.rb +7 -0
  56. metadata +173 -0
@@ -0,0 +1,143 @@
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::Sqlvirtualmachine::Mgmt::V2017_03_01_preview
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class SqlVirtualMachineManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Subscription ID that identifies an Azure subscription.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] API version to use for the request.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [AvailabilityGroupListeners] availability_group_listeners
39
+ attr_reader :availability_group_listeners
40
+
41
+ # @return [Operations] operations
42
+ attr_reader :operations
43
+
44
+ # @return [SqlVirtualMachineGroups] sql_virtual_machine_groups
45
+ attr_reader :sql_virtual_machine_groups
46
+
47
+ # @return [SqlVirtualMachines] sql_virtual_machines
48
+ attr_reader :sql_virtual_machines
49
+
50
+ #
51
+ # Creates initializes a new instance of the SqlVirtualMachineManagementClient class.
52
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
53
+ # @param base_url [String] the base URI of the service.
54
+ # @param options [Array] filters to be applied to the HTTP requests.
55
+ #
56
+ def initialize(credentials = nil, base_url = nil, options = nil)
57
+ super(credentials, options)
58
+ @base_url = base_url || 'https://management.azure.com'
59
+
60
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
61
+ @credentials = credentials
62
+
63
+ @availability_group_listeners = AvailabilityGroupListeners.new(self)
64
+ @operations = Operations.new(self)
65
+ @sql_virtual_machine_groups = SqlVirtualMachineGroups.new(self)
66
+ @sql_virtual_machines = SqlVirtualMachines.new(self)
67
+ @api_version = '2017-03-01-preview'
68
+ @accept_language = 'en-US'
69
+ @long_running_operation_retry_timeout = 30
70
+ @generate_client_request_id = true
71
+ add_telemetry
72
+ end
73
+
74
+ #
75
+ # Makes a request and returns the body of the response.
76
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
77
+ # @param path [String] the path, relative to {base_url}.
78
+ # @param options [Hash{String=>String}] specifying any request options like :body.
79
+ # @return [Hash{String=>String}] containing the body of the response.
80
+ # Example:
81
+ #
82
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
83
+ # path = "/path"
84
+ # options = {
85
+ # body: request_content,
86
+ # query_params: {'api-version' => '2016-02-01'}
87
+ # }
88
+ # result = @client.make_request(:put, path, options)
89
+ #
90
+ def make_request(method, path, options = {})
91
+ result = make_request_with_http_info(method, path, options)
92
+ result.body unless result.nil?
93
+ end
94
+
95
+ #
96
+ # Makes a request and returns the operation response.
97
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
98
+ # @param path [String] the path, relative to {base_url}.
99
+ # @param options [Hash{String=>String}] specifying any request options like :body.
100
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
101
+ #
102
+ def make_request_with_http_info(method, path, options = {})
103
+ result = make_request_async(method, path, options).value!
104
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
105
+ result
106
+ end
107
+
108
+ #
109
+ # Makes a request asynchronously.
110
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
111
+ # @param path [String] the path, relative to {base_url}.
112
+ # @param options [Hash{String=>String}] specifying any request options like :body.
113
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
114
+ #
115
+ def make_request_async(method, path, options = {})
116
+ fail ArgumentError, 'method is nil' if method.nil?
117
+ fail ArgumentError, 'path is nil' if path.nil?
118
+
119
+ request_url = options[:base_url] || @base_url
120
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
121
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
122
+ end
123
+
124
+ request_headers = @request_headers
125
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
126
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
127
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
128
+
129
+ super(request_url, method, path, options)
130
+ end
131
+
132
+
133
+ private
134
+ #
135
+ # Adds telemetry information.
136
+ #
137
+ def add_telemetry
138
+ sdk_information = 'azure_mgmt_sqlvirtualmachine'
139
+ sdk_information = "#{sdk_information}/0.17.0"
140
+ add_user_agent_information(sdk_information)
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,980 @@
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::Sqlvirtualmachine::Mgmt::V2017_03_01_preview
7
+ #
8
+ # The SQL virtual machine management API provides a RESTful set of web APIs
9
+ # that interact with Azure Compute, Network & Storage services to manage your
10
+ # SQL Server virtual machine. The API enables users to create, delete and
11
+ # retrieve a SQL virtual machine, SQL virtual machine group or availability
12
+ # group listener.
13
+ #
14
+ class SqlVirtualMachines
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the SqlVirtualMachines class.
19
+ # @param client service class for accessing basic functionality.
20
+ #
21
+ def initialize(client)
22
+ @client = client
23
+ end
24
+
25
+ # @return [SqlVirtualMachineManagementClient] reference to the SqlVirtualMachineManagementClient
26
+ attr_reader :client
27
+
28
+ #
29
+ # Gets a SQL virtual machine.
30
+ #
31
+ # @param resource_group_name [String] Name of the resource group that contains
32
+ # the resource. You can obtain this value from the Azure Resource Manager API
33
+ # or the portal.
34
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
35
+ # @param expand [String] The child resources to include in the response.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [SqlVirtualMachine] operation results.
40
+ #
41
+ def get(resource_group_name, sql_virtual_machine_name, expand:nil, custom_headers:nil)
42
+ response = get_async(resource_group_name, sql_virtual_machine_name, expand:expand, custom_headers:custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Gets a SQL virtual machine.
48
+ #
49
+ # @param resource_group_name [String] Name of the resource group that contains
50
+ # the resource. You can obtain this value from the Azure Resource Manager API
51
+ # or the portal.
52
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
53
+ # @param expand [String] The child resources to include in the response.
54
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
55
+ # will be added to the HTTP request.
56
+ #
57
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
58
+ #
59
+ def get_with_http_info(resource_group_name, sql_virtual_machine_name, expand:nil, custom_headers:nil)
60
+ get_async(resource_group_name, sql_virtual_machine_name, expand:expand, custom_headers:custom_headers).value!
61
+ end
62
+
63
+ #
64
+ # Gets a SQL virtual machine.
65
+ #
66
+ # @param resource_group_name [String] Name of the resource group that contains
67
+ # the resource. You can obtain this value from the Azure Resource Manager API
68
+ # or the portal.
69
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
70
+ # @param expand [String] The child resources to include in the response.
71
+ # @param [Hash{String => String}] A hash of custom headers that will be added
72
+ # to the HTTP request.
73
+ #
74
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
75
+ #
76
+ def get_async(resource_group_name, sql_virtual_machine_name, expand:nil, custom_headers:nil)
77
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
78
+ fail ArgumentError, 'sql_virtual_machine_name is nil' if sql_virtual_machine_name.nil?
79
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+
82
+
83
+ request_headers = {}
84
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
85
+
86
+ # Set Headers
87
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
88
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
89
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'resourceGroupName' => resource_group_name,'sqlVirtualMachineName' => sql_virtual_machine_name,'subscriptionId' => @client.subscription_id},
96
+ query_params: {'$expand' => expand,'api-version' => @client.api_version},
97
+ headers: request_headers.merge(custom_headers || {}),
98
+ base_url: request_url
99
+ }
100
+ promise = @client.make_request_async(:get, path_template, options)
101
+
102
+ promise = promise.then do |result|
103
+ http_response = result.response
104
+ status_code = http_response.status
105
+ response_content = http_response.body
106
+ unless status_code == 200
107
+ error_model = JSON.load(response_content)
108
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
109
+ end
110
+
111
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
112
+ # Deserialize Response
113
+ if status_code == 200
114
+ begin
115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
116
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachine.mapper()
117
+ result.body = @client.deserialize(result_mapper, parsed_response)
118
+ rescue Exception => e
119
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
120
+ end
121
+ end
122
+
123
+ result
124
+ end
125
+
126
+ promise.execute
127
+ end
128
+
129
+ #
130
+ # Creates or updates a SQL virtual machine.
131
+ #
132
+ # @param resource_group_name [String] Name of the resource group that contains
133
+ # the resource. You can obtain this value from the Azure Resource Manager API
134
+ # or the portal.
135
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
136
+ # @param parameters [SqlVirtualMachine] The SQL virtual machine.
137
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
138
+ # will be added to the HTTP request.
139
+ #
140
+ # @return [SqlVirtualMachine] operation results.
141
+ #
142
+ def create_or_update(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
143
+ response = create_or_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:custom_headers).value!
144
+ response.body unless response.nil?
145
+ end
146
+
147
+ #
148
+ # @param resource_group_name [String] Name of the resource group that contains
149
+ # the resource. You can obtain this value from the Azure Resource Manager API
150
+ # or the portal.
151
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
152
+ # @param parameters [SqlVirtualMachine] The SQL virtual machine.
153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
154
+ # will be added to the HTTP request.
155
+ #
156
+ # @return [Concurrent::Promise] promise which provides async access to http
157
+ # response.
158
+ #
159
+ def create_or_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
160
+ # Send request
161
+ promise = begin_create_or_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:custom_headers)
162
+
163
+ promise = promise.then do |response|
164
+ # Defining deserialization method.
165
+ deserialize_method = lambda do |parsed_response|
166
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachine.mapper()
167
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
168
+ end
169
+
170
+ # Waiting for response.
171
+ @client.get_long_running_operation_result(response, deserialize_method)
172
+ end
173
+
174
+ promise
175
+ end
176
+
177
+ #
178
+ # Deletes a SQL virtual machine.
179
+ #
180
+ # @param resource_group_name [String] Name of the resource group that contains
181
+ # the resource. You can obtain this value from the Azure Resource Manager API
182
+ # or the portal.
183
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
184
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
185
+ # will be added to the HTTP request.
186
+ #
187
+ def delete(resource_group_name, sql_virtual_machine_name, custom_headers:nil)
188
+ response = delete_async(resource_group_name, sql_virtual_machine_name, custom_headers:custom_headers).value!
189
+ nil
190
+ end
191
+
192
+ #
193
+ # @param resource_group_name [String] Name of the resource group that contains
194
+ # the resource. You can obtain this value from the Azure Resource Manager API
195
+ # or the portal.
196
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
197
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
198
+ # will be added to the HTTP request.
199
+ #
200
+ # @return [Concurrent::Promise] promise which provides async access to http
201
+ # response.
202
+ #
203
+ def delete_async(resource_group_name, sql_virtual_machine_name, custom_headers:nil)
204
+ # Send request
205
+ promise = begin_delete_async(resource_group_name, sql_virtual_machine_name, custom_headers:custom_headers)
206
+
207
+ promise = promise.then do |response|
208
+ # Defining deserialization method.
209
+ deserialize_method = lambda do |parsed_response|
210
+ end
211
+
212
+ # Waiting for response.
213
+ @client.get_long_running_operation_result(response, deserialize_method)
214
+ end
215
+
216
+ promise
217
+ end
218
+
219
+ #
220
+ # Updates a SQL virtual machine.
221
+ #
222
+ # @param resource_group_name [String] Name of the resource group that contains
223
+ # the resource. You can obtain this value from the Azure Resource Manager API
224
+ # or the portal.
225
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
226
+ # @param parameters [SqlVirtualMachineUpdate] The SQL virtual machine.
227
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
228
+ # will be added to the HTTP request.
229
+ #
230
+ # @return [SqlVirtualMachine] operation results.
231
+ #
232
+ def update(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
233
+ response = update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:custom_headers).value!
234
+ response.body unless response.nil?
235
+ end
236
+
237
+ #
238
+ # @param resource_group_name [String] Name of the resource group that contains
239
+ # the resource. You can obtain this value from the Azure Resource Manager API
240
+ # or the portal.
241
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
242
+ # @param parameters [SqlVirtualMachineUpdate] The SQL virtual machine.
243
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
244
+ # will be added to the HTTP request.
245
+ #
246
+ # @return [Concurrent::Promise] promise which provides async access to http
247
+ # response.
248
+ #
249
+ def update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
250
+ # Send request
251
+ promise = begin_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:custom_headers)
252
+
253
+ promise = promise.then do |response|
254
+ # Defining deserialization method.
255
+ deserialize_method = lambda do |parsed_response|
256
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachine.mapper()
257
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
258
+ end
259
+
260
+ # Waiting for response.
261
+ @client.get_long_running_operation_result(response, deserialize_method)
262
+ end
263
+
264
+ promise
265
+ end
266
+
267
+ #
268
+ # Gets all SQL virtual machines in a resource group.
269
+ #
270
+ # @param resource_group_name [String] Name of the resource group that contains
271
+ # the resource. You can obtain this value from the Azure Resource Manager API
272
+ # or the portal.
273
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
274
+ # will be added to the HTTP request.
275
+ #
276
+ # @return [Array<SqlVirtualMachine>] operation results.
277
+ #
278
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
279
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
280
+ first_page.get_all_items
281
+ end
282
+
283
+ #
284
+ # Gets all SQL virtual machines in a resource group.
285
+ #
286
+ # @param resource_group_name [String] Name of the resource group that contains
287
+ # the resource. You can obtain this value from the Azure Resource Manager API
288
+ # or the portal.
289
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
290
+ # will be added to the HTTP request.
291
+ #
292
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
293
+ #
294
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
295
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
296
+ end
297
+
298
+ #
299
+ # Gets all SQL virtual machines in a resource group.
300
+ #
301
+ # @param resource_group_name [String] Name of the resource group that contains
302
+ # the resource. You can obtain this value from the Azure Resource Manager API
303
+ # or the portal.
304
+ # @param [Hash{String => String}] A hash of custom headers that will be added
305
+ # to the HTTP request.
306
+ #
307
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
308
+ #
309
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
310
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
311
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
312
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
313
+
314
+
315
+ request_headers = {}
316
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
317
+
318
+ # Set Headers
319
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
320
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
321
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines'
322
+
323
+ request_url = @base_url || @client.base_url
324
+
325
+ options = {
326
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
327
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
328
+ query_params: {'api-version' => @client.api_version},
329
+ headers: request_headers.merge(custom_headers || {}),
330
+ base_url: request_url
331
+ }
332
+ promise = @client.make_request_async(:get, path_template, options)
333
+
334
+ promise = promise.then do |result|
335
+ http_response = result.response
336
+ status_code = http_response.status
337
+ response_content = http_response.body
338
+ unless status_code == 200
339
+ error_model = JSON.load(response_content)
340
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
341
+ end
342
+
343
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
344
+ # Deserialize Response
345
+ if status_code == 200
346
+ begin
347
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
348
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineListResult.mapper()
349
+ result.body = @client.deserialize(result_mapper, parsed_response)
350
+ rescue Exception => e
351
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
352
+ end
353
+ end
354
+
355
+ result
356
+ end
357
+
358
+ promise.execute
359
+ end
360
+
361
+ #
362
+ # Gets all SQL virtual machines in a subscription.
363
+ #
364
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
365
+ # will be added to the HTTP request.
366
+ #
367
+ # @return [Array<SqlVirtualMachine>] operation results.
368
+ #
369
+ def list(custom_headers:nil)
370
+ first_page = list_as_lazy(custom_headers:custom_headers)
371
+ first_page.get_all_items
372
+ end
373
+
374
+ #
375
+ # Gets all SQL virtual machines in a subscription.
376
+ #
377
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
378
+ # will be added to the HTTP request.
379
+ #
380
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
381
+ #
382
+ def list_with_http_info(custom_headers:nil)
383
+ list_async(custom_headers:custom_headers).value!
384
+ end
385
+
386
+ #
387
+ # Gets all SQL virtual machines in a subscription.
388
+ #
389
+ # @param [Hash{String => String}] A hash of custom headers that will be added
390
+ # to the HTTP request.
391
+ #
392
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
393
+ #
394
+ def list_async(custom_headers:nil)
395
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
396
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
397
+
398
+
399
+ request_headers = {}
400
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
401
+
402
+ # Set Headers
403
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
404
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
405
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines'
406
+
407
+ request_url = @base_url || @client.base_url
408
+
409
+ options = {
410
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
411
+ path_params: {'subscriptionId' => @client.subscription_id},
412
+ query_params: {'api-version' => @client.api_version},
413
+ headers: request_headers.merge(custom_headers || {}),
414
+ base_url: request_url
415
+ }
416
+ promise = @client.make_request_async(:get, path_template, options)
417
+
418
+ promise = promise.then do |result|
419
+ http_response = result.response
420
+ status_code = http_response.status
421
+ response_content = http_response.body
422
+ unless status_code == 200
423
+ error_model = JSON.load(response_content)
424
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
425
+ end
426
+
427
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
428
+ # Deserialize Response
429
+ if status_code == 200
430
+ begin
431
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
432
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineListResult.mapper()
433
+ result.body = @client.deserialize(result_mapper, parsed_response)
434
+ rescue Exception => e
435
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
436
+ end
437
+ end
438
+
439
+ result
440
+ end
441
+
442
+ promise.execute
443
+ end
444
+
445
+ #
446
+ # Creates or updates a SQL virtual machine.
447
+ #
448
+ # @param resource_group_name [String] Name of the resource group that contains
449
+ # the resource. You can obtain this value from the Azure Resource Manager API
450
+ # or the portal.
451
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
452
+ # @param parameters [SqlVirtualMachine] The SQL virtual machine.
453
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
454
+ # will be added to the HTTP request.
455
+ #
456
+ # @return [SqlVirtualMachine] operation results.
457
+ #
458
+ def begin_create_or_update(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
459
+ response = begin_create_or_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:custom_headers).value!
460
+ response.body unless response.nil?
461
+ end
462
+
463
+ #
464
+ # Creates or updates a SQL virtual machine.
465
+ #
466
+ # @param resource_group_name [String] Name of the resource group that contains
467
+ # the resource. You can obtain this value from the Azure Resource Manager API
468
+ # or the portal.
469
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
470
+ # @param parameters [SqlVirtualMachine] The SQL virtual machine.
471
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
472
+ # will be added to the HTTP request.
473
+ #
474
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
475
+ #
476
+ def begin_create_or_update_with_http_info(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
477
+ begin_create_or_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:custom_headers).value!
478
+ end
479
+
480
+ #
481
+ # Creates or updates a SQL virtual machine.
482
+ #
483
+ # @param resource_group_name [String] Name of the resource group that contains
484
+ # the resource. You can obtain this value from the Azure Resource Manager API
485
+ # or the portal.
486
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
487
+ # @param parameters [SqlVirtualMachine] The SQL virtual machine.
488
+ # @param [Hash{String => String}] A hash of custom headers that will be added
489
+ # to the HTTP request.
490
+ #
491
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
492
+ #
493
+ def begin_create_or_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
494
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
495
+ fail ArgumentError, 'sql_virtual_machine_name is nil' if sql_virtual_machine_name.nil?
496
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
497
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
498
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
499
+
500
+
501
+ request_headers = {}
502
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
503
+
504
+ # Set Headers
505
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
506
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
507
+
508
+ # Serialize Request
509
+ request_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachine.mapper()
510
+ request_content = @client.serialize(request_mapper, parameters)
511
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
512
+
513
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}'
514
+
515
+ request_url = @base_url || @client.base_url
516
+
517
+ options = {
518
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
519
+ path_params: {'resourceGroupName' => resource_group_name,'sqlVirtualMachineName' => sql_virtual_machine_name,'subscriptionId' => @client.subscription_id},
520
+ query_params: {'api-version' => @client.api_version},
521
+ body: request_content,
522
+ headers: request_headers.merge(custom_headers || {}),
523
+ base_url: request_url
524
+ }
525
+ promise = @client.make_request_async(:put, path_template, options)
526
+
527
+ promise = promise.then do |result|
528
+ http_response = result.response
529
+ status_code = http_response.status
530
+ response_content = http_response.body
531
+ unless status_code == 200 || status_code == 201
532
+ error_model = JSON.load(response_content)
533
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
534
+ end
535
+
536
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
537
+ # Deserialize Response
538
+ if status_code == 200
539
+ begin
540
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
541
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachine.mapper()
542
+ result.body = @client.deserialize(result_mapper, parsed_response)
543
+ rescue Exception => e
544
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
545
+ end
546
+ end
547
+ # Deserialize Response
548
+ if status_code == 201
549
+ begin
550
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
551
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachine.mapper()
552
+ result.body = @client.deserialize(result_mapper, parsed_response)
553
+ rescue Exception => e
554
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
555
+ end
556
+ end
557
+
558
+ result
559
+ end
560
+
561
+ promise.execute
562
+ end
563
+
564
+ #
565
+ # Deletes a SQL virtual machine.
566
+ #
567
+ # @param resource_group_name [String] Name of the resource group that contains
568
+ # the resource. You can obtain this value from the Azure Resource Manager API
569
+ # or the portal.
570
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
571
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
572
+ # will be added to the HTTP request.
573
+ #
574
+ #
575
+ def begin_delete(resource_group_name, sql_virtual_machine_name, custom_headers:nil)
576
+ response = begin_delete_async(resource_group_name, sql_virtual_machine_name, custom_headers:custom_headers).value!
577
+ nil
578
+ end
579
+
580
+ #
581
+ # Deletes a SQL virtual machine.
582
+ #
583
+ # @param resource_group_name [String] Name of the resource group that contains
584
+ # the resource. You can obtain this value from the Azure Resource Manager API
585
+ # or the portal.
586
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
588
+ # will be added to the HTTP request.
589
+ #
590
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
591
+ #
592
+ def begin_delete_with_http_info(resource_group_name, sql_virtual_machine_name, custom_headers:nil)
593
+ begin_delete_async(resource_group_name, sql_virtual_machine_name, custom_headers:custom_headers).value!
594
+ end
595
+
596
+ #
597
+ # Deletes a SQL virtual machine.
598
+ #
599
+ # @param resource_group_name [String] Name of the resource group that contains
600
+ # the resource. You can obtain this value from the Azure Resource Manager API
601
+ # or the portal.
602
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
603
+ # @param [Hash{String => String}] A hash of custom headers that will be added
604
+ # to the HTTP request.
605
+ #
606
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
607
+ #
608
+ def begin_delete_async(resource_group_name, sql_virtual_machine_name, custom_headers:nil)
609
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
610
+ fail ArgumentError, 'sql_virtual_machine_name is nil' if sql_virtual_machine_name.nil?
611
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
612
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
613
+
614
+
615
+ request_headers = {}
616
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
617
+
618
+ # Set Headers
619
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
620
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
621
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}'
622
+
623
+ request_url = @base_url || @client.base_url
624
+
625
+ options = {
626
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
627
+ path_params: {'resourceGroupName' => resource_group_name,'sqlVirtualMachineName' => sql_virtual_machine_name,'subscriptionId' => @client.subscription_id},
628
+ query_params: {'api-version' => @client.api_version},
629
+ headers: request_headers.merge(custom_headers || {}),
630
+ base_url: request_url
631
+ }
632
+ promise = @client.make_request_async(:delete, path_template, options)
633
+
634
+ promise = promise.then do |result|
635
+ http_response = result.response
636
+ status_code = http_response.status
637
+ response_content = http_response.body
638
+ unless status_code == 200 || status_code == 202 || status_code == 204
639
+ error_model = JSON.load(response_content)
640
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
641
+ end
642
+
643
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
644
+
645
+ result
646
+ end
647
+
648
+ promise.execute
649
+ end
650
+
651
+ #
652
+ # Updates a SQL virtual machine.
653
+ #
654
+ # @param resource_group_name [String] Name of the resource group that contains
655
+ # the resource. You can obtain this value from the Azure Resource Manager API
656
+ # or the portal.
657
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
658
+ # @param parameters [SqlVirtualMachineUpdate] The SQL virtual machine.
659
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
660
+ # will be added to the HTTP request.
661
+ #
662
+ # @return [SqlVirtualMachine] operation results.
663
+ #
664
+ def begin_update(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
665
+ response = begin_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:custom_headers).value!
666
+ response.body unless response.nil?
667
+ end
668
+
669
+ #
670
+ # Updates a SQL virtual machine.
671
+ #
672
+ # @param resource_group_name [String] Name of the resource group that contains
673
+ # the resource. You can obtain this value from the Azure Resource Manager API
674
+ # or the portal.
675
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
676
+ # @param parameters [SqlVirtualMachineUpdate] The SQL virtual machine.
677
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
678
+ # will be added to the HTTP request.
679
+ #
680
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
681
+ #
682
+ def begin_update_with_http_info(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
683
+ begin_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:custom_headers).value!
684
+ end
685
+
686
+ #
687
+ # Updates a SQL virtual machine.
688
+ #
689
+ # @param resource_group_name [String] Name of the resource group that contains
690
+ # the resource. You can obtain this value from the Azure Resource Manager API
691
+ # or the portal.
692
+ # @param sql_virtual_machine_name [String] Name of the SQL virtual machine.
693
+ # @param parameters [SqlVirtualMachineUpdate] The SQL virtual machine.
694
+ # @param [Hash{String => String}] A hash of custom headers that will be added
695
+ # to the HTTP request.
696
+ #
697
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
698
+ #
699
+ def begin_update_async(resource_group_name, sql_virtual_machine_name, parameters, custom_headers:nil)
700
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
701
+ fail ArgumentError, 'sql_virtual_machine_name is nil' if sql_virtual_machine_name.nil?
702
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
703
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
704
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
705
+
706
+
707
+ request_headers = {}
708
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
709
+
710
+ # Set Headers
711
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
712
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
713
+
714
+ # Serialize Request
715
+ request_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineUpdate.mapper()
716
+ request_content = @client.serialize(request_mapper, parameters)
717
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
718
+
719
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}'
720
+
721
+ request_url = @base_url || @client.base_url
722
+
723
+ options = {
724
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
725
+ path_params: {'resourceGroupName' => resource_group_name,'sqlVirtualMachineName' => sql_virtual_machine_name,'subscriptionId' => @client.subscription_id},
726
+ query_params: {'api-version' => @client.api_version},
727
+ body: request_content,
728
+ headers: request_headers.merge(custom_headers || {}),
729
+ base_url: request_url
730
+ }
731
+ promise = @client.make_request_async(:patch, path_template, options)
732
+
733
+ promise = promise.then do |result|
734
+ http_response = result.response
735
+ status_code = http_response.status
736
+ response_content = http_response.body
737
+ unless status_code == 200
738
+ error_model = JSON.load(response_content)
739
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
740
+ end
741
+
742
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
743
+ # Deserialize Response
744
+ if status_code == 200
745
+ begin
746
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
747
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachine.mapper()
748
+ result.body = @client.deserialize(result_mapper, parsed_response)
749
+ rescue Exception => e
750
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
751
+ end
752
+ end
753
+
754
+ result
755
+ end
756
+
757
+ promise.execute
758
+ end
759
+
760
+ #
761
+ # Gets all SQL virtual machines in a resource group.
762
+ #
763
+ # @param next_page_link [String] The NextLink from the previous successful call
764
+ # to List operation.
765
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
766
+ # will be added to the HTTP request.
767
+ #
768
+ # @return [SqlVirtualMachineListResult] operation results.
769
+ #
770
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
771
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
772
+ response.body unless response.nil?
773
+ end
774
+
775
+ #
776
+ # Gets all SQL virtual machines in a resource group.
777
+ #
778
+ # @param next_page_link [String] The NextLink from the previous successful call
779
+ # to List operation.
780
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
781
+ # will be added to the HTTP request.
782
+ #
783
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
784
+ #
785
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
786
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
787
+ end
788
+
789
+ #
790
+ # Gets all SQL virtual machines in a resource group.
791
+ #
792
+ # @param next_page_link [String] The NextLink from the previous successful call
793
+ # to List operation.
794
+ # @param [Hash{String => String}] A hash of custom headers that will be added
795
+ # to the HTTP request.
796
+ #
797
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
798
+ #
799
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
800
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
801
+
802
+
803
+ request_headers = {}
804
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
805
+
806
+ # Set Headers
807
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
808
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
809
+ path_template = '{nextLink}'
810
+
811
+ request_url = @base_url || @client.base_url
812
+
813
+ options = {
814
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
815
+ skip_encoding_path_params: {'nextLink' => next_page_link},
816
+ headers: request_headers.merge(custom_headers || {}),
817
+ base_url: request_url
818
+ }
819
+ promise = @client.make_request_async(:get, path_template, options)
820
+
821
+ promise = promise.then do |result|
822
+ http_response = result.response
823
+ status_code = http_response.status
824
+ response_content = http_response.body
825
+ unless status_code == 200
826
+ error_model = JSON.load(response_content)
827
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
828
+ end
829
+
830
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
831
+ # Deserialize Response
832
+ if status_code == 200
833
+ begin
834
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
835
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineListResult.mapper()
836
+ result.body = @client.deserialize(result_mapper, parsed_response)
837
+ rescue Exception => e
838
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
839
+ end
840
+ end
841
+
842
+ result
843
+ end
844
+
845
+ promise.execute
846
+ end
847
+
848
+ #
849
+ # Gets all SQL virtual machines in a subscription.
850
+ #
851
+ # @param next_page_link [String] The NextLink from the previous successful call
852
+ # to List operation.
853
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
854
+ # will be added to the HTTP request.
855
+ #
856
+ # @return [SqlVirtualMachineListResult] operation results.
857
+ #
858
+ def list_next(next_page_link, custom_headers:nil)
859
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
860
+ response.body unless response.nil?
861
+ end
862
+
863
+ #
864
+ # Gets all SQL virtual machines in a subscription.
865
+ #
866
+ # @param next_page_link [String] The NextLink from the previous successful call
867
+ # to List 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 [MsRestAzure::AzureOperationResponse] HTTP response information.
872
+ #
873
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
874
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
875
+ end
876
+
877
+ #
878
+ # Gets all SQL virtual machines in a subscription.
879
+ #
880
+ # @param next_page_link [String] The NextLink from the previous successful call
881
+ # to List operation.
882
+ # @param [Hash{String => String}] A hash of custom headers that will be added
883
+ # to the HTTP request.
884
+ #
885
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
886
+ #
887
+ def list_next_async(next_page_link, custom_headers:nil)
888
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
889
+
890
+
891
+ request_headers = {}
892
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
893
+
894
+ # Set Headers
895
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
896
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
897
+ path_template = '{nextLink}'
898
+
899
+ request_url = @base_url || @client.base_url
900
+
901
+ options = {
902
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
903
+ skip_encoding_path_params: {'nextLink' => next_page_link},
904
+ headers: request_headers.merge(custom_headers || {}),
905
+ base_url: request_url
906
+ }
907
+ promise = @client.make_request_async(:get, path_template, options)
908
+
909
+ promise = promise.then do |result|
910
+ http_response = result.response
911
+ status_code = http_response.status
912
+ response_content = http_response.body
913
+ unless status_code == 200
914
+ error_model = JSON.load(response_content)
915
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
916
+ end
917
+
918
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
919
+ # Deserialize Response
920
+ if status_code == 200
921
+ begin
922
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
923
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineListResult.mapper()
924
+ result.body = @client.deserialize(result_mapper, parsed_response)
925
+ rescue Exception => e
926
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
927
+ end
928
+ end
929
+
930
+ result
931
+ end
932
+
933
+ promise.execute
934
+ end
935
+
936
+ #
937
+ # Gets all SQL virtual machines in a resource group.
938
+ #
939
+ # @param resource_group_name [String] Name of the resource group that contains
940
+ # the resource. You can obtain this value from the Azure Resource Manager API
941
+ # or the portal.
942
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
943
+ # will be added to the HTTP request.
944
+ #
945
+ # @return [SqlVirtualMachineListResult] which provide lazy access to pages of
946
+ # the response.
947
+ #
948
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
949
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
950
+ unless response.nil?
951
+ page = response.body
952
+ page.next_method = Proc.new do |next_page_link|
953
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
954
+ end
955
+ page
956
+ end
957
+ end
958
+
959
+ #
960
+ # Gets all SQL virtual machines in a subscription.
961
+ #
962
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
963
+ # will be added to the HTTP request.
964
+ #
965
+ # @return [SqlVirtualMachineListResult] which provide lazy access to pages of
966
+ # the response.
967
+ #
968
+ def list_as_lazy(custom_headers:nil)
969
+ response = list_async(custom_headers:custom_headers).value!
970
+ unless response.nil?
971
+ page = response.body
972
+ page.next_method = Proc.new do |next_page_link|
973
+ list_next_async(next_page_link, custom_headers:custom_headers)
974
+ end
975
+ page
976
+ end
977
+ end
978
+
979
+ end
980
+ end