azure_mgmt_automanage 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage.rb +63 -0
  4. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/accounts.rb +646 -0
  5. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/automanage_client.rb +145 -0
  6. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/configuration_profile_assignments.rb +603 -0
  7. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/configuration_profile_preferences.rb +661 -0
  8. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/account.rb +98 -0
  9. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/account_identity.rb +74 -0
  10. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/account_list.rb +55 -0
  11. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/account_update.rb +63 -0
  12. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/azure_entity_resource.rb +75 -0
  13. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile.rb +16 -0
  14. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_assignment.rb +76 -0
  15. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_assignment_compliance.rb +48 -0
  16. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_assignment_list.rb +56 -0
  17. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_assignment_properties.rb +109 -0
  18. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference.rb +99 -0
  19. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_anti_malware.rb +105 -0
  20. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_list.rb +56 -0
  21. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_properties.rb +61 -0
  22. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_update.rb +64 -0
  23. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/configuration_profile_preference_vm_backup.rb +81 -0
  24. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/enable_real_time_protection.rb +16 -0
  25. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/error_additional_info.rb +59 -0
  26. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/error_response.rb +47 -0
  27. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/error_response_error.rb +113 -0
  28. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/operation.rb +83 -0
  29. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/operation_display.rb +79 -0
  30. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/operation_list.rb +56 -0
  31. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/provisioning_state.rb +17 -0
  32. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/proxy_resource.rb +63 -0
  33. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/resource.rb +83 -0
  34. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/resource_identity_type.rb +16 -0
  35. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/run_scheduled_scan.rb +16 -0
  36. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/scan_type.rb +16 -0
  37. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/tracked_resource.rb +92 -0
  38. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/update_resource.rb +54 -0
  39. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/models/update_status.rb +17 -0
  40. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/module_definition.rb +9 -0
  41. data/lib/2020-06-30-preview/generated/azure_mgmt_automanage/operations.rb +110 -0
  42. data/lib/azure_mgmt_automanage.rb +6 -0
  43. data/lib/module_definition.rb +7 -0
  44. data/lib/profiles/latest/automanage_latest_profile_client.rb +40 -0
  45. data/lib/profiles/latest/automanage_module_definition.rb +8 -0
  46. data/lib/profiles/latest/modules/automanage_profile_module.rb +195 -0
  47. data/lib/version.rb +7 -0
  48. metadata +163 -0
@@ -0,0 +1,661 @@
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::Automanage::Mgmt::V2020_06_30_preview
7
+ #
8
+ # Automanage Client
9
+ #
10
+ class ConfigurationProfilePreferences
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ConfigurationProfilePreferences class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AutomanageClient] reference to the AutomanageClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Creates a configuration profile preference
26
+ #
27
+ # @param configuration_profile_preference_name [String] Name of the
28
+ # configuration profile preference.
29
+ # @param resource_group_name [String] The name of the resource group. The name
30
+ # is case insensitive.
31
+ # @param parameters [ConfigurationProfilePreference] Parameters supplied to
32
+ # create or update configuration profile preference.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [ConfigurationProfilePreference] operation results.
37
+ #
38
+ def create_or_update(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:nil)
39
+ response = create_or_update_async(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Creates a configuration profile preference
45
+ #
46
+ # @param configuration_profile_preference_name [String] Name of the
47
+ # configuration profile preference.
48
+ # @param resource_group_name [String] The name of the resource group. The name
49
+ # is case insensitive.
50
+ # @param parameters [ConfigurationProfilePreference] Parameters supplied to
51
+ # create or update configuration profile preference.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def create_or_update_with_http_info(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:nil)
58
+ create_or_update_async(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Creates a configuration profile preference
63
+ #
64
+ # @param configuration_profile_preference_name [String] Name of the
65
+ # configuration profile preference.
66
+ # @param resource_group_name [String] The name of the resource group. The name
67
+ # is case insensitive.
68
+ # @param parameters [ConfigurationProfilePreference] Parameters supplied to
69
+ # create or update configuration profile preference.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def create_or_update_async(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:nil)
76
+ fail ArgumentError, 'configuration_profile_preference_name is nil' if configuration_profile_preference_name.nil?
77
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
78
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
79
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
80
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
81
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
82
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
83
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
84
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
85
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
86
+
87
+
88
+ request_headers = {}
89
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
90
+
91
+ # Set Headers
92
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
93
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
94
+
95
+ # Serialize Request
96
+ request_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfilePreference.mapper()
97
+ request_content = @client.serialize(request_mapper, parameters)
98
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
99
+
100
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'
101
+
102
+ request_url = @base_url || @client.base_url
103
+
104
+ options = {
105
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
106
+ path_params: {'configurationProfilePreferenceName' => configuration_profile_preference_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
107
+ query_params: {'api-version' => @client.api_version},
108
+ body: request_content,
109
+ headers: request_headers.merge(custom_headers || {}),
110
+ base_url: request_url
111
+ }
112
+ promise = @client.make_request_async(:put, path_template, options)
113
+
114
+ promise = promise.then do |result|
115
+ http_response = result.response
116
+ status_code = http_response.status
117
+ response_content = http_response.body
118
+ unless status_code == 201 || status_code == 200
119
+ error_model = JSON.load(response_content)
120
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
121
+ end
122
+
123
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
124
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
125
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
126
+ # Deserialize Response
127
+ if status_code == 201
128
+ begin
129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
130
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfilePreference.mapper()
131
+ result.body = @client.deserialize(result_mapper, parsed_response)
132
+ rescue Exception => e
133
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
134
+ end
135
+ end
136
+ # Deserialize Response
137
+ if status_code == 200
138
+ begin
139
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
140
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfilePreference.mapper()
141
+ result.body = @client.deserialize(result_mapper, parsed_response)
142
+ rescue Exception => e
143
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
144
+ end
145
+ end
146
+
147
+ result
148
+ end
149
+
150
+ promise.execute
151
+ end
152
+
153
+ #
154
+ # Get information about a configuration profile preference
155
+ #
156
+ # @param configuration_profile_preference_name [String] The configuration
157
+ # profile preference name.
158
+ # @param resource_group_name [String] The name of the resource group. The name
159
+ # is case insensitive.
160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
161
+ # will be added to the HTTP request.
162
+ #
163
+ # @return [ConfigurationProfilePreference] operation results.
164
+ #
165
+ def get(configuration_profile_preference_name, resource_group_name, custom_headers:nil)
166
+ response = get_async(configuration_profile_preference_name, resource_group_name, custom_headers:custom_headers).value!
167
+ response.body unless response.nil?
168
+ end
169
+
170
+ #
171
+ # Get information about a configuration profile preference
172
+ #
173
+ # @param configuration_profile_preference_name [String] The configuration
174
+ # profile preference name.
175
+ # @param resource_group_name [String] The name of the resource group. The name
176
+ # is case insensitive.
177
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
178
+ # will be added to the HTTP request.
179
+ #
180
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
181
+ #
182
+ def get_with_http_info(configuration_profile_preference_name, resource_group_name, custom_headers:nil)
183
+ get_async(configuration_profile_preference_name, resource_group_name, custom_headers:custom_headers).value!
184
+ end
185
+
186
+ #
187
+ # Get information about a configuration profile preference
188
+ #
189
+ # @param configuration_profile_preference_name [String] The configuration
190
+ # profile preference name.
191
+ # @param resource_group_name [String] The name of the resource group. The name
192
+ # is case insensitive.
193
+ # @param [Hash{String => String}] A hash of custom headers that will be added
194
+ # to the HTTP request.
195
+ #
196
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
197
+ #
198
+ def get_async(configuration_profile_preference_name, resource_group_name, custom_headers:nil)
199
+ fail ArgumentError, 'configuration_profile_preference_name is nil' if configuration_profile_preference_name.nil?
200
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
201
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
202
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
203
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
204
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
205
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
206
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
207
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
208
+
209
+
210
+ request_headers = {}
211
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
212
+
213
+ # Set Headers
214
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
215
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
216
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'
217
+
218
+ request_url = @base_url || @client.base_url
219
+
220
+ options = {
221
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
222
+ path_params: {'configurationProfilePreferenceName' => configuration_profile_preference_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
223
+ query_params: {'api-version' => @client.api_version},
224
+ headers: request_headers.merge(custom_headers || {}),
225
+ base_url: request_url
226
+ }
227
+ promise = @client.make_request_async(:get, path_template, options)
228
+
229
+ promise = promise.then do |result|
230
+ http_response = result.response
231
+ status_code = http_response.status
232
+ response_content = http_response.body
233
+ unless status_code == 200
234
+ error_model = JSON.load(response_content)
235
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
236
+ end
237
+
238
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
239
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
240
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
241
+ # Deserialize Response
242
+ if status_code == 200
243
+ begin
244
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
245
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfilePreference.mapper()
246
+ result.body = @client.deserialize(result_mapper, parsed_response)
247
+ rescue Exception => e
248
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
249
+ end
250
+ end
251
+
252
+ result
253
+ end
254
+
255
+ promise.execute
256
+ end
257
+
258
+ #
259
+ # Delete a configuration profile preference
260
+ #
261
+ # @param resource_group_name [String] The name of the resource group. The name
262
+ # is case insensitive.
263
+ # @param configuration_profile_preference_name [String] Name of the
264
+ # configuration profile preference
265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
266
+ # will be added to the HTTP request.
267
+ #
268
+ #
269
+ def delete(resource_group_name, configuration_profile_preference_name, custom_headers:nil)
270
+ response = delete_async(resource_group_name, configuration_profile_preference_name, custom_headers:custom_headers).value!
271
+ nil
272
+ end
273
+
274
+ #
275
+ # Delete a configuration profile preference
276
+ #
277
+ # @param resource_group_name [String] The name of the resource group. The name
278
+ # is case insensitive.
279
+ # @param configuration_profile_preference_name [String] Name of the
280
+ # configuration profile preference
281
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
282
+ # will be added to the HTTP request.
283
+ #
284
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
285
+ #
286
+ def delete_with_http_info(resource_group_name, configuration_profile_preference_name, custom_headers:nil)
287
+ delete_async(resource_group_name, configuration_profile_preference_name, custom_headers:custom_headers).value!
288
+ end
289
+
290
+ #
291
+ # Delete a configuration profile preference
292
+ #
293
+ # @param resource_group_name [String] The name of the resource group. The name
294
+ # is case insensitive.
295
+ # @param configuration_profile_preference_name [String] Name of the
296
+ # configuration profile preference
297
+ # @param [Hash{String => String}] A hash of custom headers that will be added
298
+ # to the HTTP request.
299
+ #
300
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
301
+ #
302
+ def delete_async(resource_group_name, configuration_profile_preference_name, custom_headers:nil)
303
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
304
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
305
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
306
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
307
+ fail ArgumentError, 'configuration_profile_preference_name is nil' if configuration_profile_preference_name.nil?
308
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
309
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
310
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
311
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
312
+
313
+
314
+ request_headers = {}
315
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
316
+
317
+ # Set Headers
318
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
319
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
320
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'
321
+
322
+ request_url = @base_url || @client.base_url
323
+
324
+ options = {
325
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
326
+ path_params: {'resourceGroupName' => resource_group_name,'configurationProfilePreferenceName' => configuration_profile_preference_name,'subscriptionId' => @client.subscription_id},
327
+ query_params: {'api-version' => @client.api_version},
328
+ headers: request_headers.merge(custom_headers || {}),
329
+ base_url: request_url
330
+ }
331
+ promise = @client.make_request_async(:delete, path_template, options)
332
+
333
+ promise = promise.then do |result|
334
+ http_response = result.response
335
+ status_code = http_response.status
336
+ response_content = http_response.body
337
+ unless status_code == 200 || status_code == 204
338
+ error_model = JSON.load(response_content)
339
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
340
+ end
341
+
342
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
343
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
344
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
345
+
346
+ result
347
+ end
348
+
349
+ promise.execute
350
+ end
351
+
352
+ #
353
+ # Updates a configuration profile preference
354
+ #
355
+ # @param configuration_profile_preference_name [String] Name of the
356
+ # configuration profile preference.
357
+ # @param resource_group_name [String] The name of the resource group. The name
358
+ # is case insensitive.
359
+ # @param parameters [ConfigurationProfilePreferenceUpdate] Parameters supplied
360
+ # to create or update configuration profile preference.
361
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
362
+ # will be added to the HTTP request.
363
+ #
364
+ # @return [ConfigurationProfilePreference] operation results.
365
+ #
366
+ def update(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:nil)
367
+ response = update_async(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:custom_headers).value!
368
+ response.body unless response.nil?
369
+ end
370
+
371
+ #
372
+ # Updates a configuration profile preference
373
+ #
374
+ # @param configuration_profile_preference_name [String] Name of the
375
+ # configuration profile preference.
376
+ # @param resource_group_name [String] The name of the resource group. The name
377
+ # is case insensitive.
378
+ # @param parameters [ConfigurationProfilePreferenceUpdate] Parameters supplied
379
+ # to create or update configuration profile preference.
380
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
381
+ # will be added to the HTTP request.
382
+ #
383
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
384
+ #
385
+ def update_with_http_info(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:nil)
386
+ update_async(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:custom_headers).value!
387
+ end
388
+
389
+ #
390
+ # Updates a configuration profile preference
391
+ #
392
+ # @param configuration_profile_preference_name [String] Name of the
393
+ # configuration profile preference.
394
+ # @param resource_group_name [String] The name of the resource group. The name
395
+ # is case insensitive.
396
+ # @param parameters [ConfigurationProfilePreferenceUpdate] Parameters supplied
397
+ # to create or update configuration profile preference.
398
+ # @param [Hash{String => String}] A hash of custom headers that will be added
399
+ # to the HTTP request.
400
+ #
401
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
402
+ #
403
+ def update_async(configuration_profile_preference_name, resource_group_name, parameters, custom_headers:nil)
404
+ fail ArgumentError, 'configuration_profile_preference_name is nil' if configuration_profile_preference_name.nil?
405
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
406
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
407
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
408
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
409
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
410
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
411
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
412
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
413
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
414
+
415
+
416
+ request_headers = {}
417
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
418
+
419
+ # Set Headers
420
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
421
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
422
+
423
+ # Serialize Request
424
+ request_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfilePreferenceUpdate.mapper()
425
+ request_content = @client.serialize(request_mapper, parameters)
426
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
427
+
428
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}'
429
+
430
+ request_url = @base_url || @client.base_url
431
+
432
+ options = {
433
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
434
+ path_params: {'configurationProfilePreferenceName' => configuration_profile_preference_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
435
+ query_params: {'api-version' => @client.api_version},
436
+ body: request_content,
437
+ headers: request_headers.merge(custom_headers || {}),
438
+ base_url: request_url
439
+ }
440
+ promise = @client.make_request_async(:patch, path_template, options)
441
+
442
+ promise = promise.then do |result|
443
+ http_response = result.response
444
+ status_code = http_response.status
445
+ response_content = http_response.body
446
+ unless status_code == 200
447
+ error_model = JSON.load(response_content)
448
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
449
+ end
450
+
451
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
452
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
453
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
454
+ # Deserialize Response
455
+ if status_code == 200
456
+ begin
457
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
458
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfilePreference.mapper()
459
+ result.body = @client.deserialize(result_mapper, parsed_response)
460
+ rescue Exception => e
461
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
462
+ end
463
+ end
464
+
465
+ result
466
+ end
467
+
468
+ promise.execute
469
+ end
470
+
471
+ #
472
+ # Retrieve a list of configuration profile preferences within a given resource
473
+ # group
474
+ #
475
+ # @param resource_group_name [String] The name of the resource group. The name
476
+ # is case insensitive.
477
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
478
+ # will be added to the HTTP request.
479
+ #
480
+ # @return [ConfigurationProfilePreferenceList] operation results.
481
+ #
482
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
483
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
484
+ response.body unless response.nil?
485
+ end
486
+
487
+ #
488
+ # Retrieve a list of configuration profile preferences within a given resource
489
+ # group
490
+ #
491
+ # @param resource_group_name [String] The name of the resource group. The name
492
+ # is case insensitive.
493
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
494
+ # will be added to the HTTP request.
495
+ #
496
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
497
+ #
498
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
499
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
500
+ end
501
+
502
+ #
503
+ # Retrieve a list of configuration profile preferences within a given resource
504
+ # group
505
+ #
506
+ # @param resource_group_name [String] The name of the resource group. The name
507
+ # is case insensitive.
508
+ # @param [Hash{String => String}] A hash of custom headers that will be added
509
+ # to the HTTP request.
510
+ #
511
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
512
+ #
513
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
514
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
515
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
516
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
517
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
518
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
519
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
520
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
521
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
522
+
523
+
524
+ request_headers = {}
525
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
526
+
527
+ # Set Headers
528
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
529
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
530
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences'
531
+
532
+ request_url = @base_url || @client.base_url
533
+
534
+ options = {
535
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
536
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
537
+ query_params: {'api-version' => @client.api_version},
538
+ headers: request_headers.merge(custom_headers || {}),
539
+ base_url: request_url
540
+ }
541
+ promise = @client.make_request_async(:get, path_template, options)
542
+
543
+ promise = promise.then do |result|
544
+ http_response = result.response
545
+ status_code = http_response.status
546
+ response_content = http_response.body
547
+ unless status_code == 200
548
+ error_model = JSON.load(response_content)
549
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
550
+ end
551
+
552
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
553
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
554
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
555
+ # Deserialize Response
556
+ if status_code == 200
557
+ begin
558
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
559
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfilePreferenceList.mapper()
560
+ result.body = @client.deserialize(result_mapper, parsed_response)
561
+ rescue Exception => e
562
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
563
+ end
564
+ end
565
+
566
+ result
567
+ end
568
+
569
+ promise.execute
570
+ end
571
+
572
+ #
573
+ # Retrieve a list of configuration profile preferences within a subscription
574
+ #
575
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
576
+ # will be added to the HTTP request.
577
+ #
578
+ # @return [ConfigurationProfilePreferenceList] operation results.
579
+ #
580
+ def list_by_subscription(custom_headers:nil)
581
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
582
+ response.body unless response.nil?
583
+ end
584
+
585
+ #
586
+ # Retrieve a list of configuration profile preferences within a subscription
587
+ #
588
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
589
+ # will be added to the HTTP request.
590
+ #
591
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
592
+ #
593
+ def list_by_subscription_with_http_info(custom_headers:nil)
594
+ list_by_subscription_async(custom_headers:custom_headers).value!
595
+ end
596
+
597
+ #
598
+ # Retrieve a list of configuration profile preferences within a subscription
599
+ #
600
+ # @param [Hash{String => String}] A hash of custom headers that will be added
601
+ # to the HTTP request.
602
+ #
603
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
604
+ #
605
+ def list_by_subscription_async(custom_headers:nil)
606
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
607
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
608
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
609
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
610
+
611
+
612
+ request_headers = {}
613
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
614
+
615
+ # Set Headers
616
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
617
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
618
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfilePreferences'
619
+
620
+ request_url = @base_url || @client.base_url
621
+
622
+ options = {
623
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
624
+ path_params: {'subscriptionId' => @client.subscription_id},
625
+ query_params: {'api-version' => @client.api_version},
626
+ headers: request_headers.merge(custom_headers || {}),
627
+ base_url: request_url
628
+ }
629
+ promise = @client.make_request_async(:get, path_template, options)
630
+
631
+ promise = promise.then do |result|
632
+ http_response = result.response
633
+ status_code = http_response.status
634
+ response_content = http_response.body
635
+ unless status_code == 200
636
+ error_model = JSON.load(response_content)
637
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
638
+ end
639
+
640
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
641
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
642
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
643
+ # Deserialize Response
644
+ if status_code == 200
645
+ begin
646
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
647
+ result_mapper = Azure::Automanage::Mgmt::V2020_06_30_preview::Models::ConfigurationProfilePreferenceList.mapper()
648
+ result.body = @client.deserialize(result_mapper, parsed_response)
649
+ rescue Exception => e
650
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
651
+ end
652
+ end
653
+
654
+ result
655
+ end
656
+
657
+ promise.execute
658
+ end
659
+
660
+ end
661
+ end