azure_mgmt_maintenance 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance.rb +48 -0
  4. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/apply_updates.rb +481 -0
  5. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/configuration_assignments.rb +747 -0
  6. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/maintenance_configurations.rb +509 -0
  7. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/maintenance_management_client.rb +149 -0
  8. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/apply_update.rb +96 -0
  9. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/configuration_assignment.rb +95 -0
  10. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/error_details.rb +58 -0
  11. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/impact_type.rb +18 -0
  12. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/list_configuration_assignments_result.rb +56 -0
  13. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/list_maintenance_configurations_result.rb +56 -0
  14. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/list_updates_result.rb +55 -0
  15. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/maintenance_configuration.rb +136 -0
  16. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/maintenance_error.rb +47 -0
  17. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/maintenance_scope.rb +18 -0
  18. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/operation.rb +80 -0
  19. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/operation_info.rb +79 -0
  20. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/operations_list_result.rb +55 -0
  21. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/resource.rb +80 -0
  22. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/update.rb +105 -0
  23. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/models/update_status.rb +19 -0
  24. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/module_definition.rb +9 -0
  25. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/operations.rb +118 -0
  26. data/lib/2018-06-01-preview/generated/azure_mgmt_maintenance/updates.rb +249 -0
  27. data/lib/azure_mgmt_maintenance.rb +6 -0
  28. data/lib/module_definition.rb +7 -0
  29. data/lib/profiles/latest/maintenance_latest_profile_client.rb +40 -0
  30. data/lib/profiles/latest/maintenance_module_definition.rb +8 -0
  31. data/lib/profiles/latest/modules/maintenance_profile_module.rb +133 -0
  32. data/lib/version.rb +7 -0
  33. metadata +148 -0
@@ -0,0 +1,747 @@
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::Maintenance::Mgmt::V2018_06_01_preview
7
+ #
8
+ # Azure Maintenance Management Client
9
+ #
10
+ class ConfigurationAssignments
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ConfigurationAssignments class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [MaintenanceManagementClient] reference to the MaintenanceManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Create configuration assignment
26
+ #
27
+ # Register configuration for resource.
28
+ #
29
+ # @param resource_group_name [String] Resource group name
30
+ # @param provider_name [String] Resource provider name
31
+ # @param resource_parent_type [String] Resource parent type
32
+ # @param resource_parent_name [String] Resource parent identifier
33
+ # @param resource_type [String] Resource type
34
+ # @param resource_name [String] Resource identifier
35
+ # @param configuration_assignment_name [String] Configuration assignment name
36
+ # @param configuration_assignment [ConfigurationAssignment] The
37
+ # configurationAssignment
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ # @return [ConfigurationAssignment] operation results.
42
+ #
43
+ def create_or_update_parent(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:nil)
44
+ response = create_or_update_parent_async(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:custom_headers).value!
45
+ response.body unless response.nil?
46
+ end
47
+
48
+ #
49
+ # Create configuration assignment
50
+ #
51
+ # Register configuration for resource.
52
+ #
53
+ # @param resource_group_name [String] Resource group name
54
+ # @param provider_name [String] Resource provider name
55
+ # @param resource_parent_type [String] Resource parent type
56
+ # @param resource_parent_name [String] Resource parent identifier
57
+ # @param resource_type [String] Resource type
58
+ # @param resource_name [String] Resource identifier
59
+ # @param configuration_assignment_name [String] Configuration assignment name
60
+ # @param configuration_assignment [ConfigurationAssignment] The
61
+ # configurationAssignment
62
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
63
+ # will be added to the HTTP request.
64
+ #
65
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
66
+ #
67
+ def create_or_update_parent_with_http_info(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:nil)
68
+ create_or_update_parent_async(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:custom_headers).value!
69
+ end
70
+
71
+ #
72
+ # Create configuration assignment
73
+ #
74
+ # Register configuration for resource.
75
+ #
76
+ # @param resource_group_name [String] Resource group name
77
+ # @param provider_name [String] Resource provider name
78
+ # @param resource_parent_type [String] Resource parent type
79
+ # @param resource_parent_name [String] Resource parent identifier
80
+ # @param resource_type [String] Resource type
81
+ # @param resource_name [String] Resource identifier
82
+ # @param configuration_assignment_name [String] Configuration assignment name
83
+ # @param configuration_assignment [ConfigurationAssignment] The
84
+ # configurationAssignment
85
+ # @param [Hash{String => String}] A hash of custom headers that will be added
86
+ # to the HTTP request.
87
+ #
88
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
89
+ #
90
+ def create_or_update_parent_async(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:nil)
91
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
92
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
93
+ fail ArgumentError, 'provider_name is nil' if provider_name.nil?
94
+ fail ArgumentError, 'resource_parent_type is nil' if resource_parent_type.nil?
95
+ fail ArgumentError, 'resource_parent_name is nil' if resource_parent_name.nil?
96
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
97
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
98
+ fail ArgumentError, 'configuration_assignment_name is nil' if configuration_assignment_name.nil?
99
+ fail ArgumentError, 'configuration_assignment is nil' if configuration_assignment.nil?
100
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
101
+
102
+
103
+ request_headers = {}
104
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
105
+
106
+ # Set Headers
107
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
108
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
109
+
110
+ # Serialize Request
111
+ request_mapper = Azure::Maintenance::Mgmt::V2018_06_01_preview::Models::ConfigurationAssignment.mapper()
112
+ request_content = @client.serialize(request_mapper, configuration_assignment)
113
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
114
+
115
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'
116
+
117
+ request_url = @base_url || @client.base_url
118
+
119
+ options = {
120
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
121
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerName' => provider_name,'resourceParentType' => resource_parent_type,'resourceParentName' => resource_parent_name,'resourceType' => resource_type,'resourceName' => resource_name,'configurationAssignmentName' => configuration_assignment_name},
122
+ query_params: {'api-version' => @client.api_version},
123
+ body: request_content,
124
+ headers: request_headers.merge(custom_headers || {}),
125
+ base_url: request_url
126
+ }
127
+ promise = @client.make_request_async(:put, path_template, options)
128
+
129
+ promise = promise.then do |result|
130
+ http_response = result.response
131
+ status_code = http_response.status
132
+ response_content = http_response.body
133
+ unless status_code == 200
134
+ error_model = JSON.load(response_content)
135
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
136
+ end
137
+
138
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
139
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
140
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
141
+ # Deserialize Response
142
+ if status_code == 200
143
+ begin
144
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
145
+ result_mapper = Azure::Maintenance::Mgmt::V2018_06_01_preview::Models::ConfigurationAssignment.mapper()
146
+ result.body = @client.deserialize(result_mapper, parsed_response)
147
+ rescue Exception => e
148
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
149
+ end
150
+ end
151
+
152
+ result
153
+ end
154
+
155
+ promise.execute
156
+ end
157
+
158
+ #
159
+ # Unregister configuration for resource
160
+ #
161
+ # Unregister configuration for resource.
162
+ #
163
+ # @param resource_group_name [String] Resource group name
164
+ # @param provider_name [String] Resource provider name
165
+ # @param resource_parent_type [String] Resource parent type
166
+ # @param resource_parent_name [String] Resource parent identifier
167
+ # @param resource_type [String] Resource type
168
+ # @param resource_name [String] Resource identifier
169
+ # @param configuration_assignment_name [String] Unique configuration assignment
170
+ # name
171
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
172
+ # will be added to the HTTP request.
173
+ #
174
+ # @return [ConfigurationAssignment] operation results.
175
+ #
176
+ def delete_parent(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, custom_headers:nil)
177
+ response = delete_parent_async(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, custom_headers:custom_headers).value!
178
+ response.body unless response.nil?
179
+ end
180
+
181
+ #
182
+ # Unregister configuration for resource
183
+ #
184
+ # Unregister configuration for resource.
185
+ #
186
+ # @param resource_group_name [String] Resource group name
187
+ # @param provider_name [String] Resource provider name
188
+ # @param resource_parent_type [String] Resource parent type
189
+ # @param resource_parent_name [String] Resource parent identifier
190
+ # @param resource_type [String] Resource type
191
+ # @param resource_name [String] Resource identifier
192
+ # @param configuration_assignment_name [String] Unique configuration assignment
193
+ # name
194
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
195
+ # will be added to the HTTP request.
196
+ #
197
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
198
+ #
199
+ def delete_parent_with_http_info(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, custom_headers:nil)
200
+ delete_parent_async(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, custom_headers:custom_headers).value!
201
+ end
202
+
203
+ #
204
+ # Unregister configuration for resource
205
+ #
206
+ # Unregister configuration for resource.
207
+ #
208
+ # @param resource_group_name [String] Resource group name
209
+ # @param provider_name [String] Resource provider name
210
+ # @param resource_parent_type [String] Resource parent type
211
+ # @param resource_parent_name [String] Resource parent identifier
212
+ # @param resource_type [String] Resource type
213
+ # @param resource_name [String] Resource identifier
214
+ # @param configuration_assignment_name [String] Unique configuration assignment
215
+ # name
216
+ # @param [Hash{String => String}] A hash of custom headers that will be added
217
+ # to the HTTP request.
218
+ #
219
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
220
+ #
221
+ def delete_parent_async(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, configuration_assignment_name, custom_headers:nil)
222
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
223
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
224
+ fail ArgumentError, 'provider_name is nil' if provider_name.nil?
225
+ fail ArgumentError, 'resource_parent_type is nil' if resource_parent_type.nil?
226
+ fail ArgumentError, 'resource_parent_name is nil' if resource_parent_name.nil?
227
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
228
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
229
+ fail ArgumentError, 'configuration_assignment_name is nil' if configuration_assignment_name.nil?
230
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
231
+
232
+
233
+ request_headers = {}
234
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
235
+
236
+ # Set Headers
237
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
238
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
239
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'
240
+
241
+ request_url = @base_url || @client.base_url
242
+
243
+ options = {
244
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
245
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerName' => provider_name,'resourceParentType' => resource_parent_type,'resourceParentName' => resource_parent_name,'resourceType' => resource_type,'resourceName' => resource_name,'configurationAssignmentName' => configuration_assignment_name},
246
+ query_params: {'api-version' => @client.api_version},
247
+ headers: request_headers.merge(custom_headers || {}),
248
+ base_url: request_url
249
+ }
250
+ promise = @client.make_request_async(:delete, path_template, options)
251
+
252
+ promise = promise.then do |result|
253
+ http_response = result.response
254
+ status_code = http_response.status
255
+ response_content = http_response.body
256
+ unless status_code == 200
257
+ error_model = JSON.load(response_content)
258
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
259
+ end
260
+
261
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
262
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
263
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
264
+ # Deserialize Response
265
+ if status_code == 200
266
+ begin
267
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
268
+ result_mapper = Azure::Maintenance::Mgmt::V2018_06_01_preview::Models::ConfigurationAssignment.mapper()
269
+ result.body = @client.deserialize(result_mapper, parsed_response)
270
+ rescue Exception => e
271
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
272
+ end
273
+ end
274
+
275
+ result
276
+ end
277
+
278
+ promise.execute
279
+ end
280
+
281
+ #
282
+ # Create configuration assignment
283
+ #
284
+ # Register configuration for resource.
285
+ #
286
+ # @param resource_group_name [String] Resource group name
287
+ # @param provider_name [String] Resource provider name
288
+ # @param resource_type [String] Resource type
289
+ # @param resource_name [String] Resource identifier
290
+ # @param configuration_assignment_name [String] Configuration assignment name
291
+ # @param configuration_assignment [ConfigurationAssignment] The
292
+ # configurationAssignment
293
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
294
+ # will be added to the HTTP request.
295
+ #
296
+ # @return [ConfigurationAssignment] operation results.
297
+ #
298
+ def create_or_update(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:nil)
299
+ response = create_or_update_async(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:custom_headers).value!
300
+ response.body unless response.nil?
301
+ end
302
+
303
+ #
304
+ # Create configuration assignment
305
+ #
306
+ # Register configuration for resource.
307
+ #
308
+ # @param resource_group_name [String] Resource group name
309
+ # @param provider_name [String] Resource provider name
310
+ # @param resource_type [String] Resource type
311
+ # @param resource_name [String] Resource identifier
312
+ # @param configuration_assignment_name [String] Configuration assignment name
313
+ # @param configuration_assignment [ConfigurationAssignment] The
314
+ # configurationAssignment
315
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
316
+ # will be added to the HTTP request.
317
+ #
318
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
319
+ #
320
+ def create_or_update_with_http_info(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:nil)
321
+ create_or_update_async(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:custom_headers).value!
322
+ end
323
+
324
+ #
325
+ # Create configuration assignment
326
+ #
327
+ # Register configuration for resource.
328
+ #
329
+ # @param resource_group_name [String] Resource group name
330
+ # @param provider_name [String] Resource provider name
331
+ # @param resource_type [String] Resource type
332
+ # @param resource_name [String] Resource identifier
333
+ # @param configuration_assignment_name [String] Configuration assignment name
334
+ # @param configuration_assignment [ConfigurationAssignment] The
335
+ # configurationAssignment
336
+ # @param [Hash{String => String}] A hash of custom headers that will be added
337
+ # to the HTTP request.
338
+ #
339
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
340
+ #
341
+ def create_or_update_async(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, configuration_assignment, custom_headers:nil)
342
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
343
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
344
+ fail ArgumentError, 'provider_name is nil' if provider_name.nil?
345
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
346
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
347
+ fail ArgumentError, 'configuration_assignment_name is nil' if configuration_assignment_name.nil?
348
+ fail ArgumentError, 'configuration_assignment is nil' if configuration_assignment.nil?
349
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
350
+
351
+
352
+ request_headers = {}
353
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
354
+
355
+ # Set Headers
356
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
357
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
358
+
359
+ # Serialize Request
360
+ request_mapper = Azure::Maintenance::Mgmt::V2018_06_01_preview::Models::ConfigurationAssignment.mapper()
361
+ request_content = @client.serialize(request_mapper, configuration_assignment)
362
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
363
+
364
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'
365
+
366
+ request_url = @base_url || @client.base_url
367
+
368
+ options = {
369
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
370
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerName' => provider_name,'resourceType' => resource_type,'resourceName' => resource_name,'configurationAssignmentName' => configuration_assignment_name},
371
+ query_params: {'api-version' => @client.api_version},
372
+ body: request_content,
373
+ headers: request_headers.merge(custom_headers || {}),
374
+ base_url: request_url
375
+ }
376
+ promise = @client.make_request_async(:put, path_template, options)
377
+
378
+ promise = promise.then do |result|
379
+ http_response = result.response
380
+ status_code = http_response.status
381
+ response_content = http_response.body
382
+ unless status_code == 200
383
+ error_model = JSON.load(response_content)
384
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
385
+ end
386
+
387
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
388
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
389
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
390
+ # Deserialize Response
391
+ if status_code == 200
392
+ begin
393
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
394
+ result_mapper = Azure::Maintenance::Mgmt::V2018_06_01_preview::Models::ConfigurationAssignment.mapper()
395
+ result.body = @client.deserialize(result_mapper, parsed_response)
396
+ rescue Exception => e
397
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
398
+ end
399
+ end
400
+
401
+ result
402
+ end
403
+
404
+ promise.execute
405
+ end
406
+
407
+ #
408
+ # Unregister configuration for resource
409
+ #
410
+ # Unregister configuration for resource.
411
+ #
412
+ # @param resource_group_name [String] Resource group name
413
+ # @param provider_name [String] Resource provider name
414
+ # @param resource_type [String] Resource type
415
+ # @param resource_name [String] Resource identifier
416
+ # @param configuration_assignment_name [String] Unique configuration assignment
417
+ # name
418
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
419
+ # will be added to the HTTP request.
420
+ #
421
+ # @return [ConfigurationAssignment] operation results.
422
+ #
423
+ def delete(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, custom_headers:nil)
424
+ response = delete_async(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, custom_headers:custom_headers).value!
425
+ response.body unless response.nil?
426
+ end
427
+
428
+ #
429
+ # Unregister configuration for resource
430
+ #
431
+ # Unregister configuration for resource.
432
+ #
433
+ # @param resource_group_name [String] Resource group name
434
+ # @param provider_name [String] Resource provider name
435
+ # @param resource_type [String] Resource type
436
+ # @param resource_name [String] Resource identifier
437
+ # @param configuration_assignment_name [String] Unique configuration assignment
438
+ # name
439
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
440
+ # will be added to the HTTP request.
441
+ #
442
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
443
+ #
444
+ def delete_with_http_info(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, custom_headers:nil)
445
+ delete_async(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, custom_headers:custom_headers).value!
446
+ end
447
+
448
+ #
449
+ # Unregister configuration for resource
450
+ #
451
+ # Unregister configuration for resource.
452
+ #
453
+ # @param resource_group_name [String] Resource group name
454
+ # @param provider_name [String] Resource provider name
455
+ # @param resource_type [String] Resource type
456
+ # @param resource_name [String] Resource identifier
457
+ # @param configuration_assignment_name [String] Unique configuration assignment
458
+ # name
459
+ # @param [Hash{String => String}] A hash of custom headers that will be added
460
+ # to the HTTP request.
461
+ #
462
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
463
+ #
464
+ def delete_async(resource_group_name, provider_name, resource_type, resource_name, configuration_assignment_name, custom_headers:nil)
465
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
466
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
467
+ fail ArgumentError, 'provider_name is nil' if provider_name.nil?
468
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
469
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
470
+ fail ArgumentError, 'configuration_assignment_name is nil' if configuration_assignment_name.nil?
471
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
472
+
473
+
474
+ request_headers = {}
475
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
476
+
477
+ # Set Headers
478
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
479
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
480
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}'
481
+
482
+ request_url = @base_url || @client.base_url
483
+
484
+ options = {
485
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
486
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerName' => provider_name,'resourceType' => resource_type,'resourceName' => resource_name,'configurationAssignmentName' => configuration_assignment_name},
487
+ query_params: {'api-version' => @client.api_version},
488
+ headers: request_headers.merge(custom_headers || {}),
489
+ base_url: request_url
490
+ }
491
+ promise = @client.make_request_async(:delete, path_template, options)
492
+
493
+ promise = promise.then do |result|
494
+ http_response = result.response
495
+ status_code = http_response.status
496
+ response_content = http_response.body
497
+ unless status_code == 200
498
+ error_model = JSON.load(response_content)
499
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
500
+ end
501
+
502
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
503
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
504
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
505
+ # Deserialize Response
506
+ if status_code == 200
507
+ begin
508
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
509
+ result_mapper = Azure::Maintenance::Mgmt::V2018_06_01_preview::Models::ConfigurationAssignment.mapper()
510
+ result.body = @client.deserialize(result_mapper, parsed_response)
511
+ rescue Exception => e
512
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
513
+ end
514
+ end
515
+
516
+ result
517
+ end
518
+
519
+ promise.execute
520
+ end
521
+
522
+ #
523
+ # List configurationAssignments for resource
524
+ #
525
+ # List configurationAssignments for resource.
526
+ #
527
+ # @param resource_group_name [String] Resource group name
528
+ # @param provider_name [String] Resource provider name
529
+ # @param resource_parent_type [String] Resource parent type
530
+ # @param resource_parent_name [String] Resource parent identifier
531
+ # @param resource_type [String] Resource type
532
+ # @param resource_name [String] Resource identifier
533
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
534
+ # will be added to the HTTP request.
535
+ #
536
+ # @return [ListConfigurationAssignmentsResult] operation results.
537
+ #
538
+ def list_parent(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, custom_headers:nil)
539
+ response = list_parent_async(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, custom_headers:custom_headers).value!
540
+ response.body unless response.nil?
541
+ end
542
+
543
+ #
544
+ # List configurationAssignments for resource
545
+ #
546
+ # List configurationAssignments for resource.
547
+ #
548
+ # @param resource_group_name [String] Resource group name
549
+ # @param provider_name [String] Resource provider name
550
+ # @param resource_parent_type [String] Resource parent type
551
+ # @param resource_parent_name [String] Resource parent identifier
552
+ # @param resource_type [String] Resource type
553
+ # @param resource_name [String] Resource identifier
554
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
555
+ # will be added to the HTTP request.
556
+ #
557
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
558
+ #
559
+ def list_parent_with_http_info(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, custom_headers:nil)
560
+ list_parent_async(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, custom_headers:custom_headers).value!
561
+ end
562
+
563
+ #
564
+ # List configurationAssignments for resource
565
+ #
566
+ # List configurationAssignments for resource.
567
+ #
568
+ # @param resource_group_name [String] Resource group name
569
+ # @param provider_name [String] Resource provider name
570
+ # @param resource_parent_type [String] Resource parent type
571
+ # @param resource_parent_name [String] Resource parent identifier
572
+ # @param resource_type [String] Resource type
573
+ # @param resource_name [String] Resource identifier
574
+ # @param [Hash{String => String}] A hash of custom headers that will be added
575
+ # to the HTTP request.
576
+ #
577
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
578
+ #
579
+ def list_parent_async(resource_group_name, provider_name, resource_parent_type, resource_parent_name, resource_type, resource_name, custom_headers:nil)
580
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
581
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
582
+ fail ArgumentError, 'provider_name is nil' if provider_name.nil?
583
+ fail ArgumentError, 'resource_parent_type is nil' if resource_parent_type.nil?
584
+ fail ArgumentError, 'resource_parent_name is nil' if resource_parent_name.nil?
585
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
586
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
587
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
588
+
589
+
590
+ request_headers = {}
591
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
592
+
593
+ # Set Headers
594
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
595
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
596
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments'
597
+
598
+ request_url = @base_url || @client.base_url
599
+
600
+ options = {
601
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
602
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerName' => provider_name,'resourceParentType' => resource_parent_type,'resourceParentName' => resource_parent_name,'resourceType' => resource_type,'resourceName' => resource_name},
603
+ query_params: {'api-version' => @client.api_version},
604
+ headers: request_headers.merge(custom_headers || {}),
605
+ base_url: request_url
606
+ }
607
+ promise = @client.make_request_async(:get, path_template, options)
608
+
609
+ promise = promise.then do |result|
610
+ http_response = result.response
611
+ status_code = http_response.status
612
+ response_content = http_response.body
613
+ unless status_code == 200
614
+ error_model = JSON.load(response_content)
615
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
616
+ end
617
+
618
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
619
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
620
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
621
+ # Deserialize Response
622
+ if status_code == 200
623
+ begin
624
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
625
+ result_mapper = Azure::Maintenance::Mgmt::V2018_06_01_preview::Models::ListConfigurationAssignmentsResult.mapper()
626
+ result.body = @client.deserialize(result_mapper, parsed_response)
627
+ rescue Exception => e
628
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
629
+ end
630
+ end
631
+
632
+ result
633
+ end
634
+
635
+ promise.execute
636
+ end
637
+
638
+ #
639
+ # List configurationAssignments for resource
640
+ #
641
+ # List configurationAssignments for resource.
642
+ #
643
+ # @param resource_group_name [String] Resource group name
644
+ # @param provider_name [String] Resource provider name
645
+ # @param resource_type [String] Resource type
646
+ # @param resource_name [String] Resource identifier
647
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
648
+ # will be added to the HTTP request.
649
+ #
650
+ # @return [ListConfigurationAssignmentsResult] operation results.
651
+ #
652
+ def list(resource_group_name, provider_name, resource_type, resource_name, custom_headers:nil)
653
+ response = list_async(resource_group_name, provider_name, resource_type, resource_name, custom_headers:custom_headers).value!
654
+ response.body unless response.nil?
655
+ end
656
+
657
+ #
658
+ # List configurationAssignments for resource
659
+ #
660
+ # List configurationAssignments for resource.
661
+ #
662
+ # @param resource_group_name [String] Resource group name
663
+ # @param provider_name [String] Resource provider name
664
+ # @param resource_type [String] Resource type
665
+ # @param resource_name [String] Resource identifier
666
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
667
+ # will be added to the HTTP request.
668
+ #
669
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
670
+ #
671
+ def list_with_http_info(resource_group_name, provider_name, resource_type, resource_name, custom_headers:nil)
672
+ list_async(resource_group_name, provider_name, resource_type, resource_name, custom_headers:custom_headers).value!
673
+ end
674
+
675
+ #
676
+ # List configurationAssignments for resource
677
+ #
678
+ # List configurationAssignments for resource.
679
+ #
680
+ # @param resource_group_name [String] Resource group name
681
+ # @param provider_name [String] Resource provider name
682
+ # @param resource_type [String] Resource type
683
+ # @param resource_name [String] Resource identifier
684
+ # @param [Hash{String => String}] A hash of custom headers that will be added
685
+ # to the HTTP request.
686
+ #
687
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
688
+ #
689
+ def list_async(resource_group_name, provider_name, resource_type, resource_name, custom_headers:nil)
690
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
691
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
692
+ fail ArgumentError, 'provider_name is nil' if provider_name.nil?
693
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
694
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
695
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
696
+
697
+
698
+ request_headers = {}
699
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
700
+
701
+ # Set Headers
702
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
703
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
704
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments'
705
+
706
+ request_url = @base_url || @client.base_url
707
+
708
+ options = {
709
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
710
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerName' => provider_name,'resourceType' => resource_type,'resourceName' => resource_name},
711
+ query_params: {'api-version' => @client.api_version},
712
+ headers: request_headers.merge(custom_headers || {}),
713
+ base_url: request_url
714
+ }
715
+ promise = @client.make_request_async(:get, path_template, options)
716
+
717
+ promise = promise.then do |result|
718
+ http_response = result.response
719
+ status_code = http_response.status
720
+ response_content = http_response.body
721
+ unless status_code == 200
722
+ error_model = JSON.load(response_content)
723
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
724
+ end
725
+
726
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
727
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
728
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
729
+ # Deserialize Response
730
+ if status_code == 200
731
+ begin
732
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
733
+ result_mapper = Azure::Maintenance::Mgmt::V2018_06_01_preview::Models::ListConfigurationAssignmentsResult.mapper()
734
+ result.body = @client.deserialize(result_mapper, parsed_response)
735
+ rescue Exception => e
736
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
737
+ end
738
+ end
739
+
740
+ result
741
+ end
742
+
743
+ promise.execute
744
+ end
745
+
746
+ end
747
+ end