azure_mgmt_resources 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_resources.rb +22 -22
  3. data/lib/generated/azure_mgmt_resources/deployment_operations.rb +54 -50
  4. data/lib/generated/azure_mgmt_resources/deployments.rb +401 -315
  5. data/lib/generated/azure_mgmt_resources/models/alias_path_type.rb +3 -3
  6. data/lib/generated/azure_mgmt_resources/models/alias_type.rb +2 -2
  7. data/lib/generated/azure_mgmt_resources/models/basic_dependency.rb +1 -1
  8. data/lib/generated/azure_mgmt_resources/models/debug_setting.rb +10 -2
  9. data/lib/generated/azure_mgmt_resources/models/dependency.rb +1 -1
  10. data/lib/generated/azure_mgmt_resources/models/deployment.rb +1 -1
  11. data/lib/generated/azure_mgmt_resources/models/deployment_export_result.rb +2 -2
  12. data/lib/generated/azure_mgmt_resources/models/deployment_extended.rb +1 -1
  13. data/lib/generated/azure_mgmt_resources/models/deployment_extended_filter.rb +1 -1
  14. data/lib/generated/azure_mgmt_resources/models/deployment_list_result.rb +4 -3
  15. data/lib/generated/azure_mgmt_resources/models/deployment_mode.rb +1 -1
  16. data/lib/generated/azure_mgmt_resources/models/deployment_operation.rb +5 -3
  17. data/lib/generated/azure_mgmt_resources/models/deployment_operation_properties.rb +9 -1
  18. data/lib/generated/azure_mgmt_resources/models/deployment_operations_list_result.rb +4 -3
  19. data/lib/generated/azure_mgmt_resources/models/deployment_properties.rb +24 -10
  20. data/lib/generated/azure_mgmt_resources/models/deployment_properties_extended.rb +9 -5
  21. data/lib/generated/azure_mgmt_resources/models/deployment_validate_result.rb +1 -1
  22. data/lib/generated/azure_mgmt_resources/models/export_template_request.rb +4 -4
  23. data/lib/generated/azure_mgmt_resources/models/generic_resource.rb +7 -4
  24. data/lib/generated/azure_mgmt_resources/models/generic_resource_filter.rb +1 -1
  25. data/lib/generated/azure_mgmt_resources/models/http_message.rb +2 -1
  26. data/lib/generated/azure_mgmt_resources/models/identity.rb +3 -3
  27. data/lib/generated/azure_mgmt_resources/models/parameters_link.rb +3 -3
  28. data/lib/generated/azure_mgmt_resources/models/plan.rb +1 -1
  29. data/lib/generated/azure_mgmt_resources/models/provider.rb +6 -3
  30. data/lib/generated/azure_mgmt_resources/models/provider_list_result.rb +4 -3
  31. data/lib/generated/azure_mgmt_resources/models/provider_resource_type.rb +4 -4
  32. data/lib/generated/azure_mgmt_resources/models/resource_group.rb +15 -5
  33. data/lib/generated/azure_mgmt_resources/models/resource_group_export_result.rb +2 -1
  34. data/lib/generated/azure_mgmt_resources/models/resource_group_filter.rb +1 -1
  35. data/lib/generated/azure_mgmt_resources/models/resource_group_list_result.rb +5 -4
  36. data/lib/generated/azure_mgmt_resources/models/resource_group_properties.rb +1 -1
  37. data/lib/generated/azure_mgmt_resources/models/resource_identity_type.rb +1 -1
  38. data/lib/generated/azure_mgmt_resources/models/resource_list_result.rb +5 -4
  39. data/lib/generated/azure_mgmt_resources/models/resource_management_error_with_details.rb +10 -5
  40. data/lib/generated/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +1 -1
  41. data/lib/generated/azure_mgmt_resources/models/resources_move_info.rb +2 -2
  42. data/lib/generated/azure_mgmt_resources/models/sku.rb +8 -8
  43. data/lib/generated/azure_mgmt_resources/models/tag_count.rb +1 -1
  44. data/lib/generated/azure_mgmt_resources/models/tag_details.rb +4 -2
  45. data/lib/generated/azure_mgmt_resources/models/tag_value.rb +1 -1
  46. data/lib/generated/azure_mgmt_resources/models/tags_list_result.rb +5 -4
  47. data/lib/generated/azure_mgmt_resources/models/target_resource.rb +1 -1
  48. data/lib/generated/azure_mgmt_resources/models/template_link.rb +3 -3
  49. data/lib/generated/azure_mgmt_resources/module_definition.rb +1 -1
  50. data/lib/generated/azure_mgmt_resources/providers.rb +88 -80
  51. data/lib/generated/azure_mgmt_resources/resource_groups.rb +247 -228
  52. data/lib/generated/azure_mgmt_resources/resource_management_client.rb +17 -6
  53. data/lib/generated/azure_mgmt_resources/resources.rb +869 -245
  54. data/lib/generated/azure_mgmt_resources/tags.rb +79 -54
  55. data/lib/generated/azure_mgmt_resources/version.rb +2 -2
  56. metadata +4 -4
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -17,12 +17,10 @@ module Azure::ARM::Resources
17
17
  # @return Credentials needed for the client to connect to Azure.
18
18
  attr_reader :credentials
19
19
 
20
- # @return [String] Gets subscription credentials which uniquely identify
21
- # Microsoft Azure subscription. The subscription ID forms part of the URI
22
- # for every service call.
20
+ # @return [String] The ID of the target subscription.
23
21
  attr_accessor :subscription_id
24
22
 
25
- # @return [String] Client Api Version.
23
+ # @return [String] The API version to use for this operation.
26
24
  attr_reader :api_version
27
25
 
28
26
  # @return [String] Gets or sets the preferred language for the response.
@@ -74,10 +72,11 @@ module Azure::ARM::Resources
74
72
  @resources = Resources.new(self)
75
73
  @tags = Tags.new(self)
76
74
  @deployment_operations = DeploymentOperations.new(self)
77
- @api_version = '2016-02-01'
75
+ @api_version = '2016-09-01'
78
76
  @accept_language = 'en-US'
79
77
  @long_running_operation_retry_timeout = 30
80
78
  @generate_client_request_id = true
79
+ add_telemetry
81
80
  end
82
81
 
83
82
  #
@@ -135,5 +134,17 @@ module Azure::ARM::Resources
135
134
  super(request_url, method, path, options)
136
135
  end
137
136
 
137
+
138
+ private
139
+ #
140
+ # Adds telemetry information.
141
+ #
142
+ def add_telemetry
143
+ sdk_information = 'azure_mgmt_resources'
144
+ if defined? Azure::ARM::Resources::VERSION
145
+ sdk_information = "#{sdk_information}/#{Azure::ARM::Resources::VERSION}"
146
+ end
147
+ add_user_agent_information(sdk_information)
148
+ end
138
149
  end
139
150
  end
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::Resources
7
7
  #
8
- # Resources
8
+ # Provides operations for working with resources and resource groups.
9
9
  #
10
10
  class Resources
11
11
  include Azure::ARM::Resources::Models
@@ -23,11 +23,17 @@ module Azure::ARM::Resources
23
23
  attr_reader :client
24
24
 
25
25
  #
26
- # Move resources from one resource group to another. The resources being moved
27
- # should all be in the same resource group.
26
+ # Moves resources from one resource group to another resource group.
28
27
  #
29
- # @param source_resource_group_name [String] Source resource group name.
30
- # @param parameters [ResourcesMoveInfo] move resources' parameters.
28
+ # The resources to move must be in the same source resource group. The target
29
+ # resource group may be in a different subscription. When moving resources,
30
+ # both the source group and the target group are locked for the duration of the
31
+ # operation. Write and delete operations are blocked on the groups until the
32
+ # move completes.
33
+ #
34
+ # @param source_resource_group_name [String] The name of the resource group
35
+ # containing the rsources to move.
36
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
31
37
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
38
  # will be added to the HTTP request.
33
39
  #
@@ -37,8 +43,9 @@ module Azure::ARM::Resources
37
43
  end
38
44
 
39
45
  #
40
- # @param source_resource_group_name [String] Source resource group name.
41
- # @param parameters [ResourcesMoveInfo] move resources' parameters.
46
+ # @param source_resource_group_name [String] The name of the resource group
47
+ # containing the rsources to move.
48
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
42
49
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
43
50
  # will be added to the HTTP request.
44
51
  #
@@ -62,49 +69,51 @@ module Azure::ARM::Resources
62
69
  end
63
70
 
64
71
  #
65
- # Move resources from one resource group to another. The resources being moved
66
- # should all be in the same resource group.
72
+ # Get all the resources in a subscription.
67
73
  #
68
- # @param source_resource_group_name [String] Source resource group name.
69
- # @param parameters [ResourcesMoveInfo] move resources' parameters.
74
+ # @param filter [String] The filter to apply on the operation.
75
+ # @param expand [String] The $expand query parameter.
76
+ # @param top [Integer] The number of results to return. If null is passed,
77
+ # returns all resource groups.
70
78
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
71
79
  # will be added to the HTTP request.
72
80
  #
81
+ # @return [Array<GenericResource>] operation results.
73
82
  #
74
- def begin_move_resources(source_resource_group_name, parameters, custom_headers = nil)
75
- response = begin_move_resources_async(source_resource_group_name, parameters, custom_headers).value!
76
- nil
83
+ def list(filter = nil, expand = nil, top = nil, custom_headers = nil)
84
+ first_page = list_as_lazy(filter, expand, top, custom_headers)
85
+ first_page.get_all_items
77
86
  end
78
87
 
79
88
  #
80
- # Move resources from one resource group to another. The resources being moved
81
- # should all be in the same resource group.
89
+ # Get all the resources in a subscription.
82
90
  #
83
- # @param source_resource_group_name [String] Source resource group name.
84
- # @param parameters [ResourcesMoveInfo] move resources' parameters.
91
+ # @param filter [String] The filter to apply on the operation.
92
+ # @param expand [String] The $expand query parameter.
93
+ # @param top [Integer] The number of results to return. If null is passed,
94
+ # returns all resource groups.
85
95
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
86
96
  # will be added to the HTTP request.
87
97
  #
88
98
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
89
99
  #
90
- def begin_move_resources_with_http_info(source_resource_group_name, parameters, custom_headers = nil)
91
- begin_move_resources_async(source_resource_group_name, parameters, custom_headers).value!
100
+ def list_with_http_info(filter = nil, expand = nil, top = nil, custom_headers = nil)
101
+ list_async(filter, expand, top, custom_headers).value!
92
102
  end
93
103
 
94
104
  #
95
- # Move resources from one resource group to another. The resources being moved
96
- # should all be in the same resource group.
105
+ # Get all the resources in a subscription.
97
106
  #
98
- # @param source_resource_group_name [String] Source resource group name.
99
- # @param parameters [ResourcesMoveInfo] move resources' parameters.
107
+ # @param filter [String] The filter to apply on the operation.
108
+ # @param expand [String] The $expand query parameter.
109
+ # @param top [Integer] The number of results to return. If null is passed,
110
+ # returns all resource groups.
100
111
  # @param [Hash{String => String}] A hash of custom headers that will be added
101
112
  # to the HTTP request.
102
113
  #
103
114
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
104
115
  #
105
- def begin_move_resources_async(source_resource_group_name, parameters, custom_headers = nil)
106
- fail ArgumentError, 'source_resource_group_name is nil' if source_resource_group_name.nil?
107
- fail ArgumentError, 'parameters is nil' if parameters.nil?
116
+ def list_async(filter = nil, expand = nil, top = nil, custom_headers = nil)
108
117
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
109
118
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
110
119
 
@@ -114,117 +123,598 @@ module Azure::ARM::Resources
114
123
  # Set Headers
115
124
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
116
125
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
126
+ path_template = '/subscriptions/{subscriptionId}/resources'
117
127
 
118
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
128
+ request_url = @base_url || @client.base_url
119
129
 
120
- # Serialize Request
121
- request_mapper = ResourcesMoveInfo.mapper()
122
- request_content = @client.serialize(request_mapper, parameters, 'parameters')
123
- request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
130
+ options = {
131
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
132
+ path_params: {'subscriptionId' => @client.subscription_id},
133
+ query_params: {'$filter' => filter,'$expand' => expand,'$top' => top,'api-version' => @client.api_version},
134
+ headers: request_headers.merge(custom_headers || {}),
135
+ base_url: request_url
136
+ }
137
+ promise = @client.make_request_async(:get, path_template, options)
124
138
 
125
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'
139
+ promise = promise.then do |result|
140
+ http_response = result.response
141
+ status_code = http_response.status
142
+ response_content = http_response.body
143
+ unless status_code == 200
144
+ error_model = JSON.load(response_content)
145
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
146
+ end
147
+
148
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
149
+ # Deserialize Response
150
+ if status_code == 200
151
+ begin
152
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
153
+ result_mapper = ResourceListResult.mapper()
154
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
155
+ rescue Exception => e
156
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
157
+ end
158
+ end
159
+
160
+ result
161
+ end
162
+
163
+ promise.execute
164
+ end
165
+
166
+ #
167
+ # Checks whether a resource exists.
168
+ #
169
+ # @param resource_group_name [String] The name of the resource group containing
170
+ # the resource to check. The name is case insensitive.
171
+ # @param resource_provider_namespace [String] The resource provider of the
172
+ # resource to check.
173
+ # @param parent_resource_path [String] The parent resource identity.
174
+ # @param resource_type [String] The resource type.
175
+ # @param resource_name [String] The name of the resource to check whether it
176
+ # exists.
177
+ # @param api_version [String] The API version to use for the operation.
178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
179
+ # will be added to the HTTP request.
180
+ #
181
+ # @return [Boolean] operation results.
182
+ #
183
+ def check_existence(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
184
+ response = check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
185
+ response.body unless response.nil?
186
+ end
187
+
188
+ #
189
+ # Checks whether a resource exists.
190
+ #
191
+ # @param resource_group_name [String] The name of the resource group containing
192
+ # the resource to check. The name is case insensitive.
193
+ # @param resource_provider_namespace [String] The resource provider of the
194
+ # resource to check.
195
+ # @param parent_resource_path [String] The parent resource identity.
196
+ # @param resource_type [String] The resource type.
197
+ # @param resource_name [String] The name of the resource to check whether it
198
+ # exists.
199
+ # @param api_version [String] The API version to use for the operation.
200
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
201
+ # will be added to the HTTP request.
202
+ #
203
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
204
+ #
205
+ def check_existence_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
206
+ check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
207
+ end
208
+
209
+ #
210
+ # Checks whether a resource exists.
211
+ #
212
+ # @param resource_group_name [String] The name of the resource group containing
213
+ # the resource to check. The name is case insensitive.
214
+ # @param resource_provider_namespace [String] The resource provider of the
215
+ # resource to check.
216
+ # @param parent_resource_path [String] The parent resource identity.
217
+ # @param resource_type [String] The resource type.
218
+ # @param resource_name [String] The name of the resource to check whether it
219
+ # exists.
220
+ # @param api_version [String] The API version to use for the operation.
221
+ # @param [Hash{String => String}] A hash of custom headers that will be added
222
+ # to the HTTP request.
223
+ #
224
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
225
+ #
226
+ def check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
227
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
228
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
229
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
230
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
231
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
232
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
233
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
234
+
235
+
236
+ request_headers = {}
237
+
238
+ # Set Headers
239
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
240
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
241
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
126
242
 
127
243
  request_url = @base_url || @client.base_url
128
244
 
129
245
  options = {
130
246
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
131
- path_params: {'sourceResourceGroupName' => source_resource_group_name,'subscriptionId' => @client.subscription_id},
132
- query_params: {'api-version' => @client.api_version},
133
- body: request_content,
247
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
248
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
249
+ query_params: {'api-version' => api_version},
134
250
  headers: request_headers.merge(custom_headers || {}),
135
251
  base_url: request_url
136
252
  }
137
- promise = @client.make_request_async(:post, path_template, options)
253
+ promise = @client.make_request_async(:head, path_template, options)
254
+
255
+ promise = promise.then do |result|
256
+ http_response = result.response
257
+ status_code = http_response.status
258
+ response_content = http_response.body
259
+ unless status_code == 204 || status_code == 404
260
+ error_model = JSON.load(response_content)
261
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
262
+ end
263
+
264
+ result.body = (status_code == 204)
265
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
266
+
267
+ result
268
+ end
269
+
270
+ promise.execute
271
+ end
272
+
273
+ #
274
+ # Deletes a resource.
275
+ #
276
+ # @param resource_group_name [String] The name of the resource group that
277
+ # contains the resource to delete. The name is case insensitive.
278
+ # @param resource_provider_namespace [String] The namespace of the resource
279
+ # provider.
280
+ # @param parent_resource_path [String] The parent resource identity.
281
+ # @param resource_type [String] The resource type.
282
+ # @param resource_name [String] The name of the resource to delete.
283
+ # @param api_version [String] The API version to use for the operation.
284
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
285
+ # will be added to the HTTP request.
286
+ #
287
+ def delete(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
288
+ response = delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
289
+ nil
290
+ end
291
+
292
+ #
293
+ # @param resource_group_name [String] The name of the resource group that
294
+ # contains the resource to delete. The name is case insensitive.
295
+ # @param resource_provider_namespace [String] The namespace of the resource
296
+ # provider.
297
+ # @param parent_resource_path [String] The parent resource identity.
298
+ # @param resource_type [String] The resource type.
299
+ # @param resource_name [String] The name of the resource to delete.
300
+ # @param api_version [String] The API version to use for the operation.
301
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
302
+ # will be added to the HTTP request.
303
+ #
304
+ # @return [Concurrent::Promise] promise which provides async access to http
305
+ # response.
306
+ #
307
+ def delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
308
+ # Send request
309
+ promise = begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers)
310
+
311
+ promise = promise.then do |response|
312
+ # Defining deserialization method.
313
+ deserialize_method = lambda do |parsed_response|
314
+ end
315
+
316
+ # Waiting for response.
317
+ @client.get_long_running_operation_result(response, deserialize_method)
318
+ end
319
+
320
+ promise
321
+ end
322
+
323
+ #
324
+ # Creates a resource.
325
+ #
326
+ # @param resource_group_name [String] The name of the resource group for the
327
+ # resource. The name is case insensitive.
328
+ # @param resource_provider_namespace [String] The namespace of the resource
329
+ # provider.
330
+ # @param parent_resource_path [String] The parent resource identity.
331
+ # @param resource_type [String] The resource type of the resource to create.
332
+ # @param resource_name [String] The name of the resource to create.
333
+ # @param api_version [String] The API version to use for the operation.
334
+ # @param parameters [GenericResource] Parameters for creating or updating the
335
+ # resource.
336
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
337
+ # will be added to the HTTP request.
338
+ #
339
+ # @return [GenericResource] operation results.
340
+ #
341
+ def create_or_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers = nil)
342
+ response = create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers).value!
343
+ response.body unless response.nil?
344
+ end
345
+
346
+ #
347
+ # @param resource_group_name [String] The name of the resource group for the
348
+ # resource. The name is case insensitive.
349
+ # @param resource_provider_namespace [String] The namespace of the resource
350
+ # provider.
351
+ # @param parent_resource_path [String] The parent resource identity.
352
+ # @param resource_type [String] The resource type of the resource to create.
353
+ # @param resource_name [String] The name of the resource to create.
354
+ # @param api_version [String] The API version to use for the operation.
355
+ # @param parameters [GenericResource] Parameters for creating or updating the
356
+ # resource.
357
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
358
+ # will be added to the HTTP request.
359
+ #
360
+ # @return [Concurrent::Promise] promise which provides async access to http
361
+ # response.
362
+ #
363
+ def create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers = nil)
364
+ # Send request
365
+ promise = begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers)
366
+
367
+ promise = promise.then do |response|
368
+ # Defining deserialization method.
369
+ deserialize_method = lambda do |parsed_response|
370
+ result_mapper = GenericResource.mapper()
371
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
372
+ end
373
+
374
+ # Waiting for response.
375
+ @client.get_long_running_operation_result(response, deserialize_method)
376
+ end
377
+
378
+ promise
379
+ end
380
+
381
+ #
382
+ # Gets a resource.
383
+ #
384
+ # @param resource_group_name [String] The name of the resource group containing
385
+ # the resource to get. The name is case insensitive.
386
+ # @param resource_provider_namespace [String] The namespace of the resource
387
+ # provider.
388
+ # @param parent_resource_path [String] The parent resource identity.
389
+ # @param resource_type [String] The resource type of the resource.
390
+ # @param resource_name [String] The name of the resource to get.
391
+ # @param api_version [String] The API version to use for the operation.
392
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
393
+ # will be added to the HTTP request.
394
+ #
395
+ # @return [GenericResource] operation results.
396
+ #
397
+ def get(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
398
+ response = get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
399
+ response.body unless response.nil?
400
+ end
401
+
402
+ #
403
+ # Gets a resource.
404
+ #
405
+ # @param resource_group_name [String] The name of the resource group containing
406
+ # the resource to get. The name is case insensitive.
407
+ # @param resource_provider_namespace [String] The namespace of the resource
408
+ # provider.
409
+ # @param parent_resource_path [String] The parent resource identity.
410
+ # @param resource_type [String] The resource type of the resource.
411
+ # @param resource_name [String] The name of the resource to get.
412
+ # @param api_version [String] The API version to use for the operation.
413
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
414
+ # will be added to the HTTP request.
415
+ #
416
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
417
+ #
418
+ def get_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
419
+ get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
420
+ end
421
+
422
+ #
423
+ # Gets a resource.
424
+ #
425
+ # @param resource_group_name [String] The name of the resource group containing
426
+ # the resource to get. The name is case insensitive.
427
+ # @param resource_provider_namespace [String] The namespace of the resource
428
+ # provider.
429
+ # @param parent_resource_path [String] The parent resource identity.
430
+ # @param resource_type [String] The resource type of the resource.
431
+ # @param resource_name [String] The name of the resource to get.
432
+ # @param api_version [String] The API version to use for the operation.
433
+ # @param [Hash{String => String}] A hash of custom headers that will be added
434
+ # to the HTTP request.
435
+ #
436
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
437
+ #
438
+ def get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
439
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
440
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
441
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
442
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
443
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
444
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
445
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
446
+
447
+
448
+ request_headers = {}
449
+
450
+ # Set Headers
451
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
452
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
453
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
454
+
455
+ request_url = @base_url || @client.base_url
456
+
457
+ options = {
458
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
459
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
460
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
461
+ query_params: {'api-version' => api_version},
462
+ headers: request_headers.merge(custom_headers || {}),
463
+ base_url: request_url
464
+ }
465
+ promise = @client.make_request_async(:get, path_template, options)
466
+
467
+ promise = promise.then do |result|
468
+ http_response = result.response
469
+ status_code = http_response.status
470
+ response_content = http_response.body
471
+ unless status_code == 200
472
+ error_model = JSON.load(response_content)
473
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
474
+ end
475
+
476
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
477
+ # Deserialize Response
478
+ if status_code == 200
479
+ begin
480
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
481
+ result_mapper = GenericResource.mapper()
482
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
483
+ rescue Exception => e
484
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
485
+ end
486
+ end
487
+
488
+ result
489
+ end
490
+
491
+ promise.execute
492
+ end
493
+
494
+ #
495
+ # Checks by ID whether a resource exists.
496
+ #
497
+ # @param resource_id [String] The fully qualified ID of the resource, including
498
+ # the resource name and resource type. Use the format,
499
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
500
+ # @param api_version [String] The API version to use for the operation.
501
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
502
+ # will be added to the HTTP request.
503
+ #
504
+ # @return [Boolean] operation results.
505
+ #
506
+ def check_existence_by_id(resource_id, api_version, custom_headers = nil)
507
+ response = check_existence_by_id_async(resource_id, api_version, custom_headers).value!
508
+ response.body unless response.nil?
509
+ end
510
+
511
+ #
512
+ # Checks by ID whether a resource exists.
513
+ #
514
+ # @param resource_id [String] The fully qualified ID of the resource, including
515
+ # the resource name and resource type. Use the format,
516
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
517
+ # @param api_version [String] The API version to use for the operation.
518
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
519
+ # will be added to the HTTP request.
520
+ #
521
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
522
+ #
523
+ def check_existence_by_id_with_http_info(resource_id, api_version, custom_headers = nil)
524
+ check_existence_by_id_async(resource_id, api_version, custom_headers).value!
525
+ end
526
+
527
+ #
528
+ # Checks by ID whether a resource exists.
529
+ #
530
+ # @param resource_id [String] The fully qualified ID of the resource, including
531
+ # the resource name and resource type. Use the format,
532
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
533
+ # @param api_version [String] The API version to use for the operation.
534
+ # @param [Hash{String => String}] A hash of custom headers that will be added
535
+ # to the HTTP request.
536
+ #
537
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
538
+ #
539
+ def check_existence_by_id_async(resource_id, api_version, custom_headers = nil)
540
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
541
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
542
+
543
+
544
+ request_headers = {}
545
+
546
+ # Set Headers
547
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
548
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
549
+ path_template = '/{resourceId}'
550
+
551
+ request_url = @base_url || @client.base_url
552
+
553
+ options = {
554
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
555
+ skip_encoding_path_params: {'resourceId' => resource_id},
556
+ query_params: {'api-version' => api_version},
557
+ headers: request_headers.merge(custom_headers || {}),
558
+ base_url: request_url
559
+ }
560
+ promise = @client.make_request_async(:head, path_template, options)
561
+
562
+ promise = promise.then do |result|
563
+ http_response = result.response
564
+ status_code = http_response.status
565
+ response_content = http_response.body
566
+ unless status_code == 204 || status_code == 404
567
+ error_model = JSON.load(response_content)
568
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
569
+ end
570
+
571
+ result.body = (status_code == 204)
572
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
573
+
574
+ result
575
+ end
576
+
577
+ promise.execute
578
+ end
579
+
580
+ #
581
+ # Deletes a resource by ID.
582
+ #
583
+ # @param resource_id [String] The fully qualified ID of the resource, including
584
+ # the resource name and resource type. Use the format,
585
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
586
+ # @param api_version [String] The API version to use for the operation.
587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
588
+ # will be added to the HTTP request.
589
+ #
590
+ def delete_by_id(resource_id, api_version, custom_headers = nil)
591
+ response = delete_by_id_async(resource_id, api_version, custom_headers).value!
592
+ nil
593
+ end
594
+
595
+ #
596
+ # @param resource_id [String] The fully qualified ID of the resource, including
597
+ # the resource name and resource type. Use the format,
598
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
599
+ # @param api_version [String] The API version to use for the operation.
600
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
601
+ # will be added to the HTTP request.
602
+ #
603
+ # @return [Concurrent::Promise] promise which provides async access to http
604
+ # response.
605
+ #
606
+ def delete_by_id_async(resource_id, api_version, custom_headers = nil)
607
+ # Send request
608
+ promise = begin_delete_by_id_async(resource_id, api_version, custom_headers)
138
609
 
139
- promise = promise.then do |result|
140
- http_response = result.response
141
- status_code = http_response.status
142
- response_content = http_response.body
143
- unless status_code == 202 || status_code == 204
144
- error_model = JSON.load(response_content)
145
- fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
610
+ promise = promise.then do |response|
611
+ # Defining deserialization method.
612
+ deserialize_method = lambda do |parsed_response|
146
613
  end
147
614
 
148
- result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
149
-
150
- result
615
+ # Waiting for response.
616
+ @client.get_long_running_operation_result(response, deserialize_method)
151
617
  end
152
618
 
153
- promise.execute
619
+ promise
154
620
  end
155
621
 
156
622
  #
157
- # Get all of the resources under a subscription.
623
+ # Create a resource by ID.
158
624
  #
159
- # @param filter [String] The filter to apply on the operation.
160
- # @param expand [String] The $expand query parameter.
161
- # @param top [Integer] Query parameters. If null is passed returns all
162
- # resource groups.
625
+ # @param resource_id [String] The fully qualified ID of the resource, including
626
+ # the resource name and resource type. Use the format,
627
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
628
+ # @param api_version [String] The API version to use for the operation.
629
+ # @param parameters [GenericResource] Create or update resource parameters.
163
630
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
164
631
  # will be added to the HTTP request.
165
632
  #
166
- # @return [ResourceListResult] which provide lazy access to pages of the
633
+ # @return [GenericResource] operation results.
634
+ #
635
+ def create_or_update_by_id(resource_id, api_version, parameters, custom_headers = nil)
636
+ response = create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers).value!
637
+ response.body unless response.nil?
638
+ end
639
+
640
+ #
641
+ # @param resource_id [String] The fully qualified ID of the resource, including
642
+ # the resource name and resource type. Use the format,
643
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
644
+ # @param api_version [String] The API version to use for the operation.
645
+ # @param parameters [GenericResource] Create or update resource parameters.
646
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
647
+ # will be added to the HTTP request.
648
+ #
649
+ # @return [Concurrent::Promise] promise which provides async access to http
167
650
  # response.
168
651
  #
169
- def list_as_lazy(filter = nil, expand = nil, top = nil, custom_headers = nil)
170
- response = list_async(filter, expand, top, custom_headers).value!
171
- unless response.nil?
172
- page = response.body
173
- page.next_method = Proc.new do |next_page_link|
174
- list_next_async(next_page_link, custom_headers)
652
+ def create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers = nil)
653
+ # Send request
654
+ promise = begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers)
655
+
656
+ promise = promise.then do |response|
657
+ # Defining deserialization method.
658
+ deserialize_method = lambda do |parsed_response|
659
+ result_mapper = GenericResource.mapper()
660
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
175
661
  end
176
- page
662
+
663
+ # Waiting for response.
664
+ @client.get_long_running_operation_result(response, deserialize_method)
177
665
  end
666
+
667
+ promise
178
668
  end
179
669
 
180
670
  #
181
- # Get all of the resources under a subscription.
671
+ # Gets a resource by ID.
182
672
  #
183
- # @param filter [String] The filter to apply on the operation.
184
- # @param expand [String] The $expand query parameter.
185
- # @param top [Integer] Query parameters. If null is passed returns all
186
- # resource groups.
673
+ # @param resource_id [String] The fully qualified ID of the resource, including
674
+ # the resource name and resource type. Use the format,
675
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
676
+ # @param api_version [String] The API version to use for the operation.
187
677
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
188
678
  # will be added to the HTTP request.
189
679
  #
190
- # @return [Array<GenericResource>] operation results.
680
+ # @return [GenericResource] operation results.
191
681
  #
192
- def list(filter = nil, expand = nil, top = nil, custom_headers = nil)
193
- first_page = list_as_lazy(filter, expand, top, custom_headers)
194
- first_page.get_all_items
682
+ def get_by_id(resource_id, api_version, custom_headers = nil)
683
+ response = get_by_id_async(resource_id, api_version, custom_headers).value!
684
+ response.body unless response.nil?
195
685
  end
196
686
 
197
687
  #
198
- # Get all of the resources under a subscription.
688
+ # Gets a resource by ID.
199
689
  #
200
- # @param filter [String] The filter to apply on the operation.
201
- # @param expand [String] The $expand query parameter.
202
- # @param top [Integer] Query parameters. If null is passed returns all
203
- # resource groups.
690
+ # @param resource_id [String] The fully qualified ID of the resource, including
691
+ # the resource name and resource type. Use the format,
692
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
693
+ # @param api_version [String] The API version to use for the operation.
204
694
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
205
695
  # will be added to the HTTP request.
206
696
  #
207
697
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
208
698
  #
209
- def list_with_http_info(filter = nil, expand = nil, top = nil, custom_headers = nil)
210
- list_async(filter, expand, top, custom_headers).value!
699
+ def get_by_id_with_http_info(resource_id, api_version, custom_headers = nil)
700
+ get_by_id_async(resource_id, api_version, custom_headers).value!
211
701
  end
212
702
 
213
703
  #
214
- # Get all of the resources under a subscription.
704
+ # Gets a resource by ID.
215
705
  #
216
- # @param filter [String] The filter to apply on the operation.
217
- # @param expand [String] The $expand query parameter.
218
- # @param top [Integer] Query parameters. If null is passed returns all
219
- # resource groups.
706
+ # @param resource_id [String] The fully qualified ID of the resource, including
707
+ # the resource name and resource type. Use the format,
708
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
709
+ # @param api_version [String] The API version to use for the operation.
220
710
  # @param [Hash{String => String}] A hash of custom headers that will be added
221
711
  # to the HTTP request.
222
712
  #
223
713
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
224
714
  #
225
- def list_async(filter = nil, expand = nil, top = nil, custom_headers = nil)
226
- fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
227
- fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
715
+ def get_by_id_async(resource_id, api_version, custom_headers = nil)
716
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
717
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
228
718
 
229
719
 
230
720
  request_headers = {}
@@ -232,14 +722,14 @@ module Azure::ARM::Resources
232
722
  # Set Headers
233
723
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
234
724
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
235
- path_template = '/subscriptions/{subscriptionId}/resources'
725
+ path_template = '/{resourceId}'
236
726
 
237
727
  request_url = @base_url || @client.base_url
238
728
 
239
729
  options = {
240
730
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
241
- path_params: {'subscriptionId' => @client.subscription_id},
242
- query_params: {'$filter' => filter,'$expand' => expand,'$top' => top,'api-version' => @client.api_version},
731
+ skip_encoding_path_params: {'resourceId' => resource_id},
732
+ query_params: {'api-version' => api_version},
243
733
  headers: request_headers.merge(custom_headers || {}),
244
734
  base_url: request_url
245
735
  }
@@ -259,7 +749,7 @@ module Azure::ARM::Resources
259
749
  if status_code == 200
260
750
  begin
261
751
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
262
- result_mapper = ResourceListResult.mapper()
752
+ result_mapper = GenericResource.mapper()
263
753
  result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
264
754
  rescue Exception => e
265
755
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -273,66 +763,68 @@ module Azure::ARM::Resources
273
763
  end
274
764
 
275
765
  #
276
- # Checks whether resource exists.
766
+ # Moves resources from one resource group to another resource group.
767
+ #
768
+ # The resources to move must be in the same source resource group. The target
769
+ # resource group may be in a different subscription. When moving resources,
770
+ # both the source group and the target group are locked for the duration of the
771
+ # operation. Write and delete operations are blocked on the groups until the
772
+ # move completes.
277
773
  #
278
- # @param resource_group_name [String] The name of the resource group. The name
279
- # is case insensitive.
280
- # @param resource_provider_namespace [String] Resource identity.
281
- # @param parent_resource_path [String] Resource identity.
282
- # @param resource_type [String] Resource identity.
283
- # @param resource_name [String] Resource identity.
284
- # @param api_version [String]
774
+ # @param source_resource_group_name [String] The name of the resource group
775
+ # containing the rsources to move.
776
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
285
777
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
286
778
  # will be added to the HTTP request.
287
779
  #
288
- # @return [Boolean] operation results.
289
780
  #
290
- def check_existence(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
291
- response = check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
292
- response.body unless response.nil?
781
+ def begin_move_resources(source_resource_group_name, parameters, custom_headers = nil)
782
+ response = begin_move_resources_async(source_resource_group_name, parameters, custom_headers).value!
783
+ nil
293
784
  end
294
785
 
295
786
  #
296
- # Checks whether resource exists.
787
+ # Moves resources from one resource group to another resource group.
788
+ #
789
+ # The resources to move must be in the same source resource group. The target
790
+ # resource group may be in a different subscription. When moving resources,
791
+ # both the source group and the target group are locked for the duration of the
792
+ # operation. Write and delete operations are blocked on the groups until the
793
+ # move completes.
297
794
  #
298
- # @param resource_group_name [String] The name of the resource group. The name
299
- # is case insensitive.
300
- # @param resource_provider_namespace [String] Resource identity.
301
- # @param parent_resource_path [String] Resource identity.
302
- # @param resource_type [String] Resource identity.
303
- # @param resource_name [String] Resource identity.
304
- # @param api_version [String]
795
+ # @param source_resource_group_name [String] The name of the resource group
796
+ # containing the rsources to move.
797
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
305
798
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
306
799
  # will be added to the HTTP request.
307
800
  #
308
801
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
309
802
  #
310
- def check_existence_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
311
- check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
803
+ def begin_move_resources_with_http_info(source_resource_group_name, parameters, custom_headers = nil)
804
+ begin_move_resources_async(source_resource_group_name, parameters, custom_headers).value!
312
805
  end
313
806
 
314
807
  #
315
- # Checks whether resource exists.
808
+ # Moves resources from one resource group to another resource group.
316
809
  #
317
- # @param resource_group_name [String] The name of the resource group. The name
318
- # is case insensitive.
319
- # @param resource_provider_namespace [String] Resource identity.
320
- # @param parent_resource_path [String] Resource identity.
321
- # @param resource_type [String] Resource identity.
322
- # @param resource_name [String] Resource identity.
323
- # @param api_version [String]
810
+ # The resources to move must be in the same source resource group. The target
811
+ # resource group may be in a different subscription. When moving resources,
812
+ # both the source group and the target group are locked for the duration of the
813
+ # operation. Write and delete operations are blocked on the groups until the
814
+ # move completes.
815
+ #
816
+ # @param source_resource_group_name [String] The name of the resource group
817
+ # containing the rsources to move.
818
+ # @param parameters [ResourcesMoveInfo] Parameters for moving resources.
324
819
  # @param [Hash{String => String}] A hash of custom headers that will be added
325
820
  # to the HTTP request.
326
821
  #
327
822
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
328
823
  #
329
- def check_existence_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
330
- fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
331
- fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
332
- fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
333
- fail ArgumentError, 'resource_type is nil' if resource_type.nil?
334
- fail ArgumentError, 'resource_name is nil' if resource_name.nil?
335
- fail ArgumentError, 'api_version is nil' if api_version.nil?
824
+ def begin_move_resources_async(source_resource_group_name, parameters, custom_headers = nil)
825
+ fail ArgumentError, 'source_resource_group_name is nil' if source_resource_group_name.nil?
826
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
827
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
336
828
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
337
829
 
338
830
 
@@ -341,30 +833,37 @@ module Azure::ARM::Resources
341
833
  # Set Headers
342
834
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
343
835
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
344
- path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
836
+
837
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
838
+
839
+ # Serialize Request
840
+ request_mapper = ResourcesMoveInfo.mapper()
841
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
842
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
843
+
844
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'
345
845
 
346
846
  request_url = @base_url || @client.base_url
347
847
 
348
848
  options = {
349
849
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
350
- path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
351
- skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
352
- query_params: {'api-version' => api_version},
850
+ path_params: {'sourceResourceGroupName' => source_resource_group_name,'subscriptionId' => @client.subscription_id},
851
+ query_params: {'api-version' => @client.api_version},
852
+ body: request_content,
353
853
  headers: request_headers.merge(custom_headers || {}),
354
854
  base_url: request_url
355
855
  }
356
- promise = @client.make_request_async(:head, path_template, options)
856
+ promise = @client.make_request_async(:post, path_template, options)
357
857
 
358
858
  promise = promise.then do |result|
359
859
  http_response = result.response
360
860
  status_code = http_response.status
361
861
  response_content = http_response.body
362
- unless status_code == 204 || status_code == 404
862
+ unless status_code == 202 || status_code == 204
363
863
  error_model = JSON.load(response_content)
364
864
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
365
865
  end
366
866
 
367
- result.body = (status_code == 204)
368
867
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
369
868
 
370
869
  result
@@ -374,59 +873,62 @@ module Azure::ARM::Resources
374
873
  end
375
874
 
376
875
  #
377
- # Delete resource and all of its resources.
876
+ # Deletes a resource.
378
877
  #
379
- # @param resource_group_name [String] The name of the resource group. The name
380
- # is case insensitive.
381
- # @param resource_provider_namespace [String] Resource identity.
382
- # @param parent_resource_path [String] Resource identity.
383
- # @param resource_type [String] Resource identity.
384
- # @param resource_name [String] Resource identity.
385
- # @param api_version [String]
878
+ # @param resource_group_name [String] The name of the resource group that
879
+ # contains the resource to delete. The name is case insensitive.
880
+ # @param resource_provider_namespace [String] The namespace of the resource
881
+ # provider.
882
+ # @param parent_resource_path [String] The parent resource identity.
883
+ # @param resource_type [String] The resource type.
884
+ # @param resource_name [String] The name of the resource to delete.
885
+ # @param api_version [String] The API version to use for the operation.
386
886
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
387
887
  # will be added to the HTTP request.
388
888
  #
389
889
  #
390
- def delete(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
391
- response = delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
890
+ def begin_delete(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
891
+ response = begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
392
892
  nil
393
893
  end
394
894
 
395
895
  #
396
- # Delete resource and all of its resources.
896
+ # Deletes a resource.
397
897
  #
398
- # @param resource_group_name [String] The name of the resource group. The name
399
- # is case insensitive.
400
- # @param resource_provider_namespace [String] Resource identity.
401
- # @param parent_resource_path [String] Resource identity.
402
- # @param resource_type [String] Resource identity.
403
- # @param resource_name [String] Resource identity.
404
- # @param api_version [String]
898
+ # @param resource_group_name [String] The name of the resource group that
899
+ # contains the resource to delete. The name is case insensitive.
900
+ # @param resource_provider_namespace [String] The namespace of the resource
901
+ # provider.
902
+ # @param parent_resource_path [String] The parent resource identity.
903
+ # @param resource_type [String] The resource type.
904
+ # @param resource_name [String] The name of the resource to delete.
905
+ # @param api_version [String] The API version to use for the operation.
405
906
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
406
907
  # will be added to the HTTP request.
407
908
  #
408
909
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
409
910
  #
410
- def delete_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
411
- delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
911
+ def begin_delete_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
912
+ begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
412
913
  end
413
914
 
414
915
  #
415
- # Delete resource and all of its resources.
916
+ # Deletes a resource.
416
917
  #
417
- # @param resource_group_name [String] The name of the resource group. The name
418
- # is case insensitive.
419
- # @param resource_provider_namespace [String] Resource identity.
420
- # @param parent_resource_path [String] Resource identity.
421
- # @param resource_type [String] Resource identity.
422
- # @param resource_name [String] Resource identity.
423
- # @param api_version [String]
918
+ # @param resource_group_name [String] The name of the resource group that
919
+ # contains the resource to delete. The name is case insensitive.
920
+ # @param resource_provider_namespace [String] The namespace of the resource
921
+ # provider.
922
+ # @param parent_resource_path [String] The parent resource identity.
923
+ # @param resource_type [String] The resource type.
924
+ # @param resource_name [String] The name of the resource to delete.
925
+ # @param api_version [String] The API version to use for the operation.
424
926
  # @param [Hash{String => String}] A hash of custom headers that will be added
425
927
  # to the HTTP request.
426
928
  #
427
929
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
428
930
  #
429
- def delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
931
+ def begin_delete_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
430
932
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
431
933
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
432
934
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
@@ -473,63 +975,69 @@ module Azure::ARM::Resources
473
975
  end
474
976
 
475
977
  #
476
- # Create a resource.
978
+ # Creates a resource.
477
979
  #
478
- # @param resource_group_name [String] The name of the resource group. The name
479
- # is case insensitive.
480
- # @param resource_provider_namespace [String] Resource identity.
481
- # @param parent_resource_path [String] Resource identity.
482
- # @param resource_type [String] Resource identity.
483
- # @param resource_name [String] Resource identity.
484
- # @param api_version [String]
485
- # @param parameters [GenericResource] Create or update resource parameters.
980
+ # @param resource_group_name [String] The name of the resource group for the
981
+ # resource. The name is case insensitive.
982
+ # @param resource_provider_namespace [String] The namespace of the resource
983
+ # provider.
984
+ # @param parent_resource_path [String] The parent resource identity.
985
+ # @param resource_type [String] The resource type of the resource to create.
986
+ # @param resource_name [String] The name of the resource to create.
987
+ # @param api_version [String] The API version to use for the operation.
988
+ # @param parameters [GenericResource] Parameters for creating or updating the
989
+ # resource.
486
990
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
487
991
  # will be added to the HTTP request.
488
992
  #
489
993
  # @return [GenericResource] operation results.
490
994
  #
491
- def create_or_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers = nil)
492
- response = create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers).value!
995
+ def begin_create_or_update(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers = nil)
996
+ response = begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers).value!
493
997
  response.body unless response.nil?
494
998
  end
495
999
 
496
1000
  #
497
- # Create a resource.
1001
+ # Creates a resource.
498
1002
  #
499
- # @param resource_group_name [String] The name of the resource group. The name
500
- # is case insensitive.
501
- # @param resource_provider_namespace [String] Resource identity.
502
- # @param parent_resource_path [String] Resource identity.
503
- # @param resource_type [String] Resource identity.
504
- # @param resource_name [String] Resource identity.
505
- # @param api_version [String]
506
- # @param parameters [GenericResource] Create or update resource parameters.
1003
+ # @param resource_group_name [String] The name of the resource group for the
1004
+ # resource. The name is case insensitive.
1005
+ # @param resource_provider_namespace [String] The namespace of the resource
1006
+ # provider.
1007
+ # @param parent_resource_path [String] The parent resource identity.
1008
+ # @param resource_type [String] The resource type of the resource to create.
1009
+ # @param resource_name [String] The name of the resource to create.
1010
+ # @param api_version [String] The API version to use for the operation.
1011
+ # @param parameters [GenericResource] Parameters for creating or updating the
1012
+ # resource.
507
1013
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
508
1014
  # will be added to the HTTP request.
509
1015
  #
510
1016
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
511
1017
  #
512
- def create_or_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers = nil)
513
- create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers).value!
1018
+ def begin_create_or_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers = nil)
1019
+ begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers).value!
514
1020
  end
515
1021
 
516
1022
  #
517
- # Create a resource.
1023
+ # Creates a resource.
518
1024
  #
519
- # @param resource_group_name [String] The name of the resource group. The name
520
- # is case insensitive.
521
- # @param resource_provider_namespace [String] Resource identity.
522
- # @param parent_resource_path [String] Resource identity.
523
- # @param resource_type [String] Resource identity.
524
- # @param resource_name [String] Resource identity.
525
- # @param api_version [String]
526
- # @param parameters [GenericResource] Create or update resource parameters.
1025
+ # @param resource_group_name [String] The name of the resource group for the
1026
+ # resource. The name is case insensitive.
1027
+ # @param resource_provider_namespace [String] The namespace of the resource
1028
+ # provider.
1029
+ # @param parent_resource_path [String] The parent resource identity.
1030
+ # @param resource_type [String] The resource type of the resource to create.
1031
+ # @param resource_name [String] The name of the resource to create.
1032
+ # @param api_version [String] The API version to use for the operation.
1033
+ # @param parameters [GenericResource] Parameters for creating or updating the
1034
+ # resource.
527
1035
  # @param [Hash{String => String}] A hash of custom headers that will be added
528
1036
  # to the HTTP request.
529
1037
  #
530
1038
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
531
1039
  #
532
- def create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers = nil)
1040
+ def begin_create_or_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers = nil)
533
1041
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
534
1042
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
535
1043
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
@@ -572,7 +1080,7 @@ module Azure::ARM::Resources
572
1080
  http_response = result.response
573
1081
  status_code = http_response.status
574
1082
  response_content = http_response.body
575
- unless status_code == 201 || status_code == 200
1083
+ unless status_code == 201 || status_code == 200 || status_code == 202
576
1084
  error_model = JSON.load(response_content)
577
1085
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
578
1086
  end
@@ -606,67 +1114,141 @@ module Azure::ARM::Resources
606
1114
  end
607
1115
 
608
1116
  #
609
- # Returns a resource belonging to a resource group.
1117
+ # Deletes a resource by ID.
1118
+ #
1119
+ # @param resource_id [String] The fully qualified ID of the resource, including
1120
+ # the resource name and resource type. Use the format,
1121
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1122
+ # @param api_version [String] The API version to use for the operation.
1123
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1124
+ # will be added to the HTTP request.
1125
+ #
1126
+ #
1127
+ def begin_delete_by_id(resource_id, api_version, custom_headers = nil)
1128
+ response = begin_delete_by_id_async(resource_id, api_version, custom_headers).value!
1129
+ nil
1130
+ end
1131
+
1132
+ #
1133
+ # Deletes a resource by ID.
1134
+ #
1135
+ # @param resource_id [String] The fully qualified ID of the resource, including
1136
+ # the resource name and resource type. Use the format,
1137
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1138
+ # @param api_version [String] The API version to use for the operation.
1139
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1140
+ # will be added to the HTTP request.
1141
+ #
1142
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1143
+ #
1144
+ def begin_delete_by_id_with_http_info(resource_id, api_version, custom_headers = nil)
1145
+ begin_delete_by_id_async(resource_id, api_version, custom_headers).value!
1146
+ end
1147
+
1148
+ #
1149
+ # Deletes a resource by ID.
1150
+ #
1151
+ # @param resource_id [String] The fully qualified ID of the resource, including
1152
+ # the resource name and resource type. Use the format,
1153
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1154
+ # @param api_version [String] The API version to use for the operation.
1155
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1156
+ # to the HTTP request.
1157
+ #
1158
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1159
+ #
1160
+ def begin_delete_by_id_async(resource_id, api_version, custom_headers = nil)
1161
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
1162
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
1163
+
1164
+
1165
+ request_headers = {}
1166
+
1167
+ # Set Headers
1168
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1169
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1170
+ path_template = '/{resourceId}'
1171
+
1172
+ request_url = @base_url || @client.base_url
1173
+
1174
+ options = {
1175
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1176
+ skip_encoding_path_params: {'resourceId' => resource_id},
1177
+ query_params: {'api-version' => api_version},
1178
+ headers: request_headers.merge(custom_headers || {}),
1179
+ base_url: request_url
1180
+ }
1181
+ promise = @client.make_request_async(:delete, path_template, options)
1182
+
1183
+ promise = promise.then do |result|
1184
+ http_response = result.response
1185
+ status_code = http_response.status
1186
+ response_content = http_response.body
1187
+ unless status_code == 200 || status_code == 204 || status_code == 202
1188
+ error_model = JSON.load(response_content)
1189
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1190
+ end
1191
+
1192
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1193
+
1194
+ result
1195
+ end
1196
+
1197
+ promise.execute
1198
+ end
1199
+
1200
+ #
1201
+ # Create a resource by ID.
610
1202
  #
611
- # @param resource_group_name [String] The name of the resource group. The name
612
- # is case insensitive.
613
- # @param resource_provider_namespace [String] Resource identity.
614
- # @param parent_resource_path [String] Resource identity.
615
- # @param resource_type [String] Resource identity.
616
- # @param resource_name [String] Resource identity.
617
- # @param api_version [String]
1203
+ # @param resource_id [String] The fully qualified ID of the resource, including
1204
+ # the resource name and resource type. Use the format,
1205
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1206
+ # @param api_version [String] The API version to use for the operation.
1207
+ # @param parameters [GenericResource] Create or update resource parameters.
618
1208
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
619
1209
  # will be added to the HTTP request.
620
1210
  #
621
1211
  # @return [GenericResource] operation results.
622
1212
  #
623
- def get(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
624
- response = get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
1213
+ def begin_create_or_update_by_id(resource_id, api_version, parameters, custom_headers = nil)
1214
+ response = begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers).value!
625
1215
  response.body unless response.nil?
626
1216
  end
627
1217
 
628
1218
  #
629
- # Returns a resource belonging to a resource group.
1219
+ # Create a resource by ID.
630
1220
  #
631
- # @param resource_group_name [String] The name of the resource group. The name
632
- # is case insensitive.
633
- # @param resource_provider_namespace [String] Resource identity.
634
- # @param parent_resource_path [String] Resource identity.
635
- # @param resource_type [String] Resource identity.
636
- # @param resource_name [String] Resource identity.
637
- # @param api_version [String]
1221
+ # @param resource_id [String] The fully qualified ID of the resource, including
1222
+ # the resource name and resource type. Use the format,
1223
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1224
+ # @param api_version [String] The API version to use for the operation.
1225
+ # @param parameters [GenericResource] Create or update resource parameters.
638
1226
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
639
1227
  # will be added to the HTTP request.
640
1228
  #
641
1229
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
642
1230
  #
643
- def get_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
644
- get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers).value!
1231
+ def begin_create_or_update_by_id_with_http_info(resource_id, api_version, parameters, custom_headers = nil)
1232
+ begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers).value!
645
1233
  end
646
1234
 
647
1235
  #
648
- # Returns a resource belonging to a resource group.
1236
+ # Create a resource by ID.
649
1237
  #
650
- # @param resource_group_name [String] The name of the resource group. The name
651
- # is case insensitive.
652
- # @param resource_provider_namespace [String] Resource identity.
653
- # @param parent_resource_path [String] Resource identity.
654
- # @param resource_type [String] Resource identity.
655
- # @param resource_name [String] Resource identity.
656
- # @param api_version [String]
1238
+ # @param resource_id [String] The fully qualified ID of the resource, including
1239
+ # the resource name and resource type. Use the format,
1240
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
1241
+ # @param api_version [String] The API version to use for the operation.
1242
+ # @param parameters [GenericResource] Create or update resource parameters.
657
1243
  # @param [Hash{String => String}] A hash of custom headers that will be added
658
1244
  # to the HTTP request.
659
1245
  #
660
1246
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
661
1247
  #
662
- def get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers = nil)
663
- fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
664
- fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
665
- fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
666
- fail ArgumentError, 'resource_type is nil' if resource_type.nil?
667
- fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1248
+ def begin_create_or_update_by_id_async(resource_id, api_version, parameters, custom_headers = nil)
1249
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
668
1250
  fail ArgumentError, 'api_version is nil' if api_version.nil?
669
- fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1251
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
670
1252
 
671
1253
 
672
1254
  request_headers = {}
@@ -674,31 +1256,49 @@ module Azure::ARM::Resources
674
1256
  # Set Headers
675
1257
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
676
1258
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
677
- path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
1259
+
1260
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1261
+
1262
+ # Serialize Request
1263
+ request_mapper = GenericResource.mapper()
1264
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
1265
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1266
+
1267
+ path_template = '/{resourceId}'
678
1268
 
679
1269
  request_url = @base_url || @client.base_url
680
1270
 
681
1271
  options = {
682
1272
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
683
- path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
684
- skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
1273
+ skip_encoding_path_params: {'resourceId' => resource_id},
685
1274
  query_params: {'api-version' => api_version},
1275
+ body: request_content,
686
1276
  headers: request_headers.merge(custom_headers || {}),
687
1277
  base_url: request_url
688
1278
  }
689
- promise = @client.make_request_async(:get, path_template, options)
1279
+ promise = @client.make_request_async(:put, path_template, options)
690
1280
 
691
1281
  promise = promise.then do |result|
692
1282
  http_response = result.response
693
1283
  status_code = http_response.status
694
1284
  response_content = http_response.body
695
- unless status_code == 200
1285
+ unless status_code == 201 || status_code == 200 || status_code == 202
696
1286
  error_model = JSON.load(response_content)
697
1287
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
698
1288
  end
699
1289
 
700
1290
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
701
1291
  # Deserialize Response
1292
+ if status_code == 201
1293
+ begin
1294
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1295
+ result_mapper = GenericResource.mapper()
1296
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1297
+ rescue Exception => e
1298
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1299
+ end
1300
+ end
1301
+ # Deserialize Response
702
1302
  if status_code == 200
703
1303
  begin
704
1304
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
@@ -716,10 +1316,10 @@ module Azure::ARM::Resources
716
1316
  end
717
1317
 
718
1318
  #
719
- # Get all of the resources under a subscription.
1319
+ # Get all the resources in a subscription.
720
1320
  #
721
- # @param next_page_link [String] The NextLink from the previous successful
722
- # call to List operation.
1321
+ # @param next_page_link [String] The NextLink from the previous successful call
1322
+ # to List operation.
723
1323
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
724
1324
  # will be added to the HTTP request.
725
1325
  #
@@ -731,10 +1331,10 @@ module Azure::ARM::Resources
731
1331
  end
732
1332
 
733
1333
  #
734
- # Get all of the resources under a subscription.
1334
+ # Get all the resources in a subscription.
735
1335
  #
736
- # @param next_page_link [String] The NextLink from the previous successful
737
- # call to List operation.
1336
+ # @param next_page_link [String] The NextLink from the previous successful call
1337
+ # to List operation.
738
1338
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
739
1339
  # will be added to the HTTP request.
740
1340
  #
@@ -745,10 +1345,10 @@ module Azure::ARM::Resources
745
1345
  end
746
1346
 
747
1347
  #
748
- # Get all of the resources under a subscription.
1348
+ # Get all the resources in a subscription.
749
1349
  #
750
- # @param next_page_link [String] The NextLink from the previous successful
751
- # call to List operation.
1350
+ # @param next_page_link [String] The NextLink from the previous successful call
1351
+ # to List operation.
752
1352
  # @param [Hash{String => String}] A hash of custom headers that will be added
753
1353
  # to the HTTP request.
754
1354
  #
@@ -802,5 +1402,29 @@ module Azure::ARM::Resources
802
1402
  promise.execute
803
1403
  end
804
1404
 
1405
+ #
1406
+ # Get all the resources in a subscription.
1407
+ #
1408
+ # @param filter [String] The filter to apply on the operation.
1409
+ # @param expand [String] The $expand query parameter.
1410
+ # @param top [Integer] The number of results to return. If null is passed,
1411
+ # returns all resource groups.
1412
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1413
+ # will be added to the HTTP request.
1414
+ #
1415
+ # @return [ResourceListResult] which provide lazy access to pages of the
1416
+ # response.
1417
+ #
1418
+ def list_as_lazy(filter = nil, expand = nil, top = nil, custom_headers = nil)
1419
+ response = list_async(filter, expand, top, custom_headers).value!
1420
+ unless response.nil?
1421
+ page = response.body
1422
+ page.next_method = Proc.new do |next_page_link|
1423
+ list_next_async(next_page_link, custom_headers)
1424
+ end
1425
+ page
1426
+ end
1427
+ end
1428
+
805
1429
  end
806
1430
  end