azure_mgmt_container_registry 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_container_registry.rb +5 -0
  4. data/lib/generated/azure_mgmt_container_registry.rb +72 -0
  5. data/lib/generated/azure_mgmt_container_registry/container_registry_management_client.rb +141 -0
  6. data/lib/generated/azure_mgmt_container_registry/models/actor.rb +47 -0
  7. data/lib/generated/azure_mgmt_container_registry/models/callback_config.rb +63 -0
  8. data/lib/generated/azure_mgmt_container_registry/models/event.rb +66 -0
  9. data/lib/generated/azure_mgmt_container_registry/models/event_content.rb +113 -0
  10. data/lib/generated/azure_mgmt_container_registry/models/event_info.rb +45 -0
  11. data/lib/generated/azure_mgmt_container_registry/models/event_list_result.rb +97 -0
  12. data/lib/generated/azure_mgmt_container_registry/models/event_request_message.rb +95 -0
  13. data/lib/generated/azure_mgmt_container_registry/models/event_response_message.rb +93 -0
  14. data/lib/generated/azure_mgmt_container_registry/models/operation_definition.rb +57 -0
  15. data/lib/generated/azure_mgmt_container_registry/models/operation_display_definition.rb +76 -0
  16. data/lib/generated/azure_mgmt_container_registry/models/operation_list_result.rb +97 -0
  17. data/lib/generated/azure_mgmt_container_registry/models/password_name.rb +16 -0
  18. data/lib/generated/azure_mgmt_container_registry/models/provisioning_state.rb +20 -0
  19. data/lib/generated/azure_mgmt_container_registry/models/regenerate_credential_parameters.rb +48 -0
  20. data/lib/generated/azure_mgmt_container_registry/models/registry.rb +165 -0
  21. data/lib/generated/azure_mgmt_container_registry/models/registry_list_credentials_result.rb +64 -0
  22. data/lib/generated/azure_mgmt_container_registry/models/registry_list_result.rb +97 -0
  23. data/lib/generated/azure_mgmt_container_registry/models/registry_name_check_request.rb +64 -0
  24. data/lib/generated/azure_mgmt_container_registry/models/registry_name_status.rb +68 -0
  25. data/lib/generated/azure_mgmt_container_registry/models/registry_password.rb +57 -0
  26. data/lib/generated/azure_mgmt_container_registry/models/registry_update_parameters.rb +88 -0
  27. data/lib/generated/azure_mgmt_container_registry/models/registry_usage.rb +76 -0
  28. data/lib/generated/azure_mgmt_container_registry/models/registry_usage_list_result.rb +54 -0
  29. data/lib/generated/azure_mgmt_container_registry/models/registry_usage_unit.rb +16 -0
  30. data/lib/generated/azure_mgmt_container_registry/models/replication.rb +106 -0
  31. data/lib/generated/azure_mgmt_container_registry/models/replication_list_result.rb +97 -0
  32. data/lib/generated/azure_mgmt_container_registry/models/replication_update_parameters.rb +52 -0
  33. data/lib/generated/azure_mgmt_container_registry/models/request.rb +88 -0
  34. data/lib/generated/azure_mgmt_container_registry/models/sku.rb +59 -0
  35. data/lib/generated/azure_mgmt_container_registry/models/sku_name.rb +18 -0
  36. data/lib/generated/azure_mgmt_container_registry/models/sku_tier.rb +16 -0
  37. data/lib/generated/azure_mgmt_container_registry/models/source.rb +59 -0
  38. data/lib/generated/azure_mgmt_container_registry/models/status.rb +70 -0
  39. data/lib/generated/azure_mgmt_container_registry/models/storage_account_properties.rb +46 -0
  40. data/lib/generated/azure_mgmt_container_registry/models/target.rb +108 -0
  41. data/lib/generated/azure_mgmt_container_registry/models/webhook.rb +135 -0
  42. data/lib/generated/azure_mgmt_container_registry/models/webhook_action.rb +16 -0
  43. data/lib/generated/azure_mgmt_container_registry/models/webhook_create_parameters.rb +133 -0
  44. data/lib/generated/azure_mgmt_container_registry/models/webhook_list_result.rb +97 -0
  45. data/lib/generated/azure_mgmt_container_registry/models/webhook_status.rb +16 -0
  46. data/lib/generated/azure_mgmt_container_registry/models/webhook_update_parameters.rb +122 -0
  47. data/lib/generated/azure_mgmt_container_registry/module_definition.rb +8 -0
  48. data/lib/generated/azure_mgmt_container_registry/operations.rb +213 -0
  49. data/lib/generated/azure_mgmt_container_registry/registries.rb +1371 -0
  50. data/lib/generated/azure_mgmt_container_registry/replications.rb +799 -0
  51. data/lib/generated/azure_mgmt_container_registry/version.rb +8 -0
  52. data/lib/generated/azure_mgmt_container_registry/webhooks.rb +1208 -0
  53. metadata +165 -0
@@ -0,0 +1,8 @@
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::ARM::ContainerRegistry
7
+ VERSION = '0.13.0'
8
+ end
@@ -0,0 +1,1208 @@
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::ARM::ContainerRegistry
7
+ #
8
+ # Webhooks
9
+ #
10
+ class Webhooks
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Webhooks class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ContainerRegistryManagementClient] reference to the ContainerRegistryManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets the properties of the specified webhook.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group to which
28
+ # the container registry belongs.
29
+ # @param registry_name [String] The name of the container registry.
30
+ # @param webhook_name [String] The name of the webhook.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [Webhook] operation results.
35
+ #
36
+ def get(resource_group_name, registry_name, webhook_name, custom_headers = nil)
37
+ response = get_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Gets the properties of the specified webhook.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group to which
45
+ # the container registry belongs.
46
+ # @param registry_name [String] The name of the container registry.
47
+ # @param webhook_name [String] The name of the webhook.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def get_with_http_info(resource_group_name, registry_name, webhook_name, custom_headers = nil)
54
+ get_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Gets the properties of the specified webhook.
59
+ #
60
+ # @param resource_group_name [String] The name of the resource group to which
61
+ # the container registry belongs.
62
+ # @param registry_name [String] The name of the container registry.
63
+ # @param webhook_name [String] The name of the webhook.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def get_async(resource_group_name, registry_name, webhook_name, custom_headers = nil)
70
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
71
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
72
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
73
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
74
+ fail ArgumentError, 'webhook_name is nil' if webhook_name.nil?
75
+
76
+
77
+ request_headers = {}
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'
83
+
84
+ request_url = @base_url || @client.base_url
85
+
86
+ options = {
87
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
88
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'webhookName' => webhook_name},
89
+ query_params: {'api-version' => @client.api_version},
90
+ headers: request_headers.merge(custom_headers || {}),
91
+ base_url: request_url
92
+ }
93
+ promise = @client.make_request_async(:get, path_template, options)
94
+
95
+ promise = promise.then do |result|
96
+ http_response = result.response
97
+ status_code = http_response.status
98
+ response_content = http_response.body
99
+ unless status_code == 200
100
+ error_model = JSON.load(response_content)
101
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
102
+ end
103
+
104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
105
+ # Deserialize Response
106
+ if status_code == 200
107
+ begin
108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
109
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Webhook.mapper()
110
+ result.body = @client.deserialize(result_mapper, parsed_response)
111
+ rescue Exception => e
112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
113
+ end
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ #
123
+ # Creates a webhook for a container registry with the specified parameters.
124
+ #
125
+ # @param resource_group_name [String] The name of the resource group to which
126
+ # the container registry belongs.
127
+ # @param registry_name [String] The name of the container registry.
128
+ # @param webhook_name [String] The name of the webhook.
129
+ # @param webhook_create_parameters [WebhookCreateParameters] The parameters for
130
+ # creating a webhook.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [Webhook] operation results.
135
+ #
136
+ def create(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers = nil)
137
+ response = create_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers).value!
138
+ response.body unless response.nil?
139
+ end
140
+
141
+ #
142
+ # @param resource_group_name [String] The name of the resource group to which
143
+ # the container registry belongs.
144
+ # @param registry_name [String] The name of the container registry.
145
+ # @param webhook_name [String] The name of the webhook.
146
+ # @param webhook_create_parameters [WebhookCreateParameters] The parameters for
147
+ # creating a webhook.
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [Concurrent::Promise] promise which provides async access to http
152
+ # response.
153
+ #
154
+ def create_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers = nil)
155
+ # Send request
156
+ promise = begin_create_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers)
157
+
158
+ promise = promise.then do |response|
159
+ # Defining deserialization method.
160
+ deserialize_method = lambda do |parsed_response|
161
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Webhook.mapper()
162
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
163
+ end
164
+
165
+ # Waiting for response.
166
+ @client.get_long_running_operation_result(response, deserialize_method)
167
+ end
168
+
169
+ promise
170
+ end
171
+
172
+ #
173
+ # Deletes a webhook from a container registry.
174
+ #
175
+ # @param resource_group_name [String] The name of the resource group to which
176
+ # the container registry belongs.
177
+ # @param registry_name [String] The name of the container registry.
178
+ # @param webhook_name [String] The name of the webhook.
179
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
180
+ # will be added to the HTTP request.
181
+ #
182
+ def delete(resource_group_name, registry_name, webhook_name, custom_headers = nil)
183
+ response = delete_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
184
+ nil
185
+ end
186
+
187
+ #
188
+ # @param resource_group_name [String] The name of the resource group to which
189
+ # the container registry belongs.
190
+ # @param registry_name [String] The name of the container registry.
191
+ # @param webhook_name [String] The name of the webhook.
192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
193
+ # will be added to the HTTP request.
194
+ #
195
+ # @return [Concurrent::Promise] promise which provides async access to http
196
+ # response.
197
+ #
198
+ def delete_async(resource_group_name, registry_name, webhook_name, custom_headers = nil)
199
+ # Send request
200
+ promise = begin_delete_async(resource_group_name, registry_name, webhook_name, custom_headers)
201
+
202
+ promise = promise.then do |response|
203
+ # Defining deserialization method.
204
+ deserialize_method = lambda do |parsed_response|
205
+ end
206
+
207
+ # Waiting for response.
208
+ @client.get_long_running_operation_result(response, deserialize_method)
209
+ end
210
+
211
+ promise
212
+ end
213
+
214
+ #
215
+ # Updates a webhook with the specified parameters.
216
+ #
217
+ # @param resource_group_name [String] The name of the resource group to which
218
+ # the container registry belongs.
219
+ # @param registry_name [String] The name of the container registry.
220
+ # @param webhook_name [String] The name of the webhook.
221
+ # @param webhook_update_parameters [WebhookUpdateParameters] The parameters for
222
+ # updating a webhook.
223
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
224
+ # will be added to the HTTP request.
225
+ #
226
+ # @return [Webhook] operation results.
227
+ #
228
+ def update(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers = nil)
229
+ response = update_async(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers).value!
230
+ response.body unless response.nil?
231
+ end
232
+
233
+ #
234
+ # @param resource_group_name [String] The name of the resource group to which
235
+ # the container registry belongs.
236
+ # @param registry_name [String] The name of the container registry.
237
+ # @param webhook_name [String] The name of the webhook.
238
+ # @param webhook_update_parameters [WebhookUpdateParameters] The parameters for
239
+ # updating a webhook.
240
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
241
+ # will be added to the HTTP request.
242
+ #
243
+ # @return [Concurrent::Promise] promise which provides async access to http
244
+ # response.
245
+ #
246
+ def update_async(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers = nil)
247
+ # Send request
248
+ promise = begin_update_async(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers)
249
+
250
+ promise = promise.then do |response|
251
+ # Defining deserialization method.
252
+ deserialize_method = lambda do |parsed_response|
253
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Webhook.mapper()
254
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
255
+ end
256
+
257
+ # Waiting for response.
258
+ @client.get_long_running_operation_result(response, deserialize_method)
259
+ end
260
+
261
+ promise
262
+ end
263
+
264
+ #
265
+ # Lists all the webhooks for the specified container registry.
266
+ #
267
+ # @param resource_group_name [String] The name of the resource group to which
268
+ # the container registry belongs.
269
+ # @param registry_name [String] The name of the container registry.
270
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
271
+ # will be added to the HTTP request.
272
+ #
273
+ # @return [Array<Webhook>] operation results.
274
+ #
275
+ def list(resource_group_name, registry_name, custom_headers = nil)
276
+ first_page = list_as_lazy(resource_group_name, registry_name, custom_headers)
277
+ first_page.get_all_items
278
+ end
279
+
280
+ #
281
+ # Lists all the webhooks for the specified container registry.
282
+ #
283
+ # @param resource_group_name [String] The name of the resource group to which
284
+ # the container registry belongs.
285
+ # @param registry_name [String] The name of the container registry.
286
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
287
+ # will be added to the HTTP request.
288
+ #
289
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
290
+ #
291
+ def list_with_http_info(resource_group_name, registry_name, custom_headers = nil)
292
+ list_async(resource_group_name, registry_name, custom_headers).value!
293
+ end
294
+
295
+ #
296
+ # Lists all the webhooks for the specified container registry.
297
+ #
298
+ # @param resource_group_name [String] The name of the resource group to which
299
+ # the container registry belongs.
300
+ # @param registry_name [String] The name of the container registry.
301
+ # @param [Hash{String => String}] A hash of custom headers that will be added
302
+ # to the HTTP request.
303
+ #
304
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
305
+ #
306
+ def list_async(resource_group_name, registry_name, custom_headers = nil)
307
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
308
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
309
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
310
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
311
+
312
+
313
+ request_headers = {}
314
+
315
+ # Set Headers
316
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
317
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
318
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'
319
+
320
+ request_url = @base_url || @client.base_url
321
+
322
+ options = {
323
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
324
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
325
+ query_params: {'api-version' => @client.api_version},
326
+ headers: request_headers.merge(custom_headers || {}),
327
+ base_url: request_url
328
+ }
329
+ promise = @client.make_request_async(:get, path_template, options)
330
+
331
+ promise = promise.then do |result|
332
+ http_response = result.response
333
+ status_code = http_response.status
334
+ response_content = http_response.body
335
+ unless status_code == 200
336
+ error_model = JSON.load(response_content)
337
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
338
+ end
339
+
340
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
341
+ # Deserialize Response
342
+ if status_code == 200
343
+ begin
344
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
345
+ result_mapper = Azure::ARM::ContainerRegistry::Models::WebhookListResult.mapper()
346
+ result.body = @client.deserialize(result_mapper, parsed_response)
347
+ rescue Exception => e
348
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
349
+ end
350
+ end
351
+
352
+ result
353
+ end
354
+
355
+ promise.execute
356
+ end
357
+
358
+ #
359
+ # Triggers a ping event to be sent to the webhook.
360
+ #
361
+ # @param resource_group_name [String] The name of the resource group to which
362
+ # the container registry belongs.
363
+ # @param registry_name [String] The name of the container registry.
364
+ # @param webhook_name [String] The name of the webhook.
365
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
366
+ # will be added to the HTTP request.
367
+ #
368
+ # @return [EventInfo] operation results.
369
+ #
370
+ def ping(resource_group_name, registry_name, webhook_name, custom_headers = nil)
371
+ response = ping_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
372
+ response.body unless response.nil?
373
+ end
374
+
375
+ #
376
+ # Triggers a ping event to be sent to the webhook.
377
+ #
378
+ # @param resource_group_name [String] The name of the resource group to which
379
+ # the container registry belongs.
380
+ # @param registry_name [String] The name of the container registry.
381
+ # @param webhook_name [String] The name of the webhook.
382
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
383
+ # will be added to the HTTP request.
384
+ #
385
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
386
+ #
387
+ def ping_with_http_info(resource_group_name, registry_name, webhook_name, custom_headers = nil)
388
+ ping_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
389
+ end
390
+
391
+ #
392
+ # Triggers a ping event to be sent to the webhook.
393
+ #
394
+ # @param resource_group_name [String] The name of the resource group to which
395
+ # the container registry belongs.
396
+ # @param registry_name [String] The name of the container registry.
397
+ # @param webhook_name [String] The name of the webhook.
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 ping_async(resource_group_name, registry_name, webhook_name, custom_headers = nil)
404
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
405
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
406
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
407
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
408
+ fail ArgumentError, 'webhook_name is nil' if webhook_name.nil?
409
+
410
+
411
+ request_headers = {}
412
+
413
+ # Set Headers
414
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
415
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
416
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'
417
+
418
+ request_url = @base_url || @client.base_url
419
+
420
+ options = {
421
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
422
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'webhookName' => webhook_name},
423
+ query_params: {'api-version' => @client.api_version},
424
+ headers: request_headers.merge(custom_headers || {}),
425
+ base_url: request_url
426
+ }
427
+ promise = @client.make_request_async(:post, path_template, options)
428
+
429
+ promise = promise.then do |result|
430
+ http_response = result.response
431
+ status_code = http_response.status
432
+ response_content = http_response.body
433
+ unless status_code == 200
434
+ error_model = JSON.load(response_content)
435
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
436
+ end
437
+
438
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
439
+ # Deserialize Response
440
+ if status_code == 200
441
+ begin
442
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
443
+ result_mapper = Azure::ARM::ContainerRegistry::Models::EventInfo.mapper()
444
+ result.body = @client.deserialize(result_mapper, parsed_response)
445
+ rescue Exception => e
446
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
447
+ end
448
+ end
449
+
450
+ result
451
+ end
452
+
453
+ promise.execute
454
+ end
455
+
456
+ #
457
+ # Gets the configuration of service URI and custom headers for the webhook.
458
+ #
459
+ # @param resource_group_name [String] The name of the resource group to which
460
+ # the container registry belongs.
461
+ # @param registry_name [String] The name of the container registry.
462
+ # @param webhook_name [String] The name of the webhook.
463
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
464
+ # will be added to the HTTP request.
465
+ #
466
+ # @return [CallbackConfig] operation results.
467
+ #
468
+ def get_callback_config(resource_group_name, registry_name, webhook_name, custom_headers = nil)
469
+ response = get_callback_config_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
470
+ response.body unless response.nil?
471
+ end
472
+
473
+ #
474
+ # Gets the configuration of service URI and custom headers for the webhook.
475
+ #
476
+ # @param resource_group_name [String] The name of the resource group to which
477
+ # the container registry belongs.
478
+ # @param registry_name [String] The name of the container registry.
479
+ # @param webhook_name [String] The name of the webhook.
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
484
+ #
485
+ def get_callback_config_with_http_info(resource_group_name, registry_name, webhook_name, custom_headers = nil)
486
+ get_callback_config_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
487
+ end
488
+
489
+ #
490
+ # Gets the configuration of service URI and custom headers for the webhook.
491
+ #
492
+ # @param resource_group_name [String] The name of the resource group to which
493
+ # the container registry belongs.
494
+ # @param registry_name [String] The name of the container registry.
495
+ # @param webhook_name [String] The name of the webhook.
496
+ # @param [Hash{String => String}] A hash of custom headers that will be added
497
+ # to the HTTP request.
498
+ #
499
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
500
+ #
501
+ def get_callback_config_async(resource_group_name, registry_name, webhook_name, custom_headers = nil)
502
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
503
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
504
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
505
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
506
+ fail ArgumentError, 'webhook_name is nil' if webhook_name.nil?
507
+
508
+
509
+ request_headers = {}
510
+
511
+ # Set Headers
512
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
513
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
514
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'
515
+
516
+ request_url = @base_url || @client.base_url
517
+
518
+ options = {
519
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
520
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'webhookName' => webhook_name},
521
+ query_params: {'api-version' => @client.api_version},
522
+ headers: request_headers.merge(custom_headers || {}),
523
+ base_url: request_url
524
+ }
525
+ promise = @client.make_request_async(:post, path_template, options)
526
+
527
+ promise = promise.then do |result|
528
+ http_response = result.response
529
+ status_code = http_response.status
530
+ response_content = http_response.body
531
+ unless status_code == 200
532
+ error_model = JSON.load(response_content)
533
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
534
+ end
535
+
536
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
537
+ # Deserialize Response
538
+ if status_code == 200
539
+ begin
540
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
541
+ result_mapper = Azure::ARM::ContainerRegistry::Models::CallbackConfig.mapper()
542
+ result.body = @client.deserialize(result_mapper, parsed_response)
543
+ rescue Exception => e
544
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
545
+ end
546
+ end
547
+
548
+ result
549
+ end
550
+
551
+ promise.execute
552
+ end
553
+
554
+ #
555
+ # Lists recent events for the specified webhook.
556
+ #
557
+ # @param resource_group_name [String] The name of the resource group to which
558
+ # the container registry belongs.
559
+ # @param registry_name [String] The name of the container registry.
560
+ # @param webhook_name [String] The name of the webhook.
561
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
562
+ # will be added to the HTTP request.
563
+ #
564
+ # @return [Array<Event>] operation results.
565
+ #
566
+ def list_events(resource_group_name, registry_name, webhook_name, custom_headers = nil)
567
+ first_page = list_events_as_lazy(resource_group_name, registry_name, webhook_name, custom_headers)
568
+ first_page.get_all_items
569
+ end
570
+
571
+ #
572
+ # Lists recent events for the specified webhook.
573
+ #
574
+ # @param resource_group_name [String] The name of the resource group to which
575
+ # the container registry belongs.
576
+ # @param registry_name [String] The name of the container registry.
577
+ # @param webhook_name [String] The name of the webhook.
578
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
579
+ # will be added to the HTTP request.
580
+ #
581
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
582
+ #
583
+ def list_events_with_http_info(resource_group_name, registry_name, webhook_name, custom_headers = nil)
584
+ list_events_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
585
+ end
586
+
587
+ #
588
+ # Lists recent events for the specified webhook.
589
+ #
590
+ # @param resource_group_name [String] The name of the resource group to which
591
+ # the container registry belongs.
592
+ # @param registry_name [String] The name of the container registry.
593
+ # @param webhook_name [String] The name of the webhook.
594
+ # @param [Hash{String => String}] A hash of custom headers that will be added
595
+ # to the HTTP request.
596
+ #
597
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
598
+ #
599
+ def list_events_async(resource_group_name, registry_name, webhook_name, custom_headers = nil)
600
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
601
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
602
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
603
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
604
+ fail ArgumentError, 'webhook_name is nil' if webhook_name.nil?
605
+
606
+
607
+ request_headers = {}
608
+
609
+ # Set Headers
610
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
611
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
612
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents'
613
+
614
+ request_url = @base_url || @client.base_url
615
+
616
+ options = {
617
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
618
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'webhookName' => webhook_name},
619
+ query_params: {'api-version' => @client.api_version},
620
+ headers: request_headers.merge(custom_headers || {}),
621
+ base_url: request_url
622
+ }
623
+ promise = @client.make_request_async(:post, path_template, options)
624
+
625
+ promise = promise.then do |result|
626
+ http_response = result.response
627
+ status_code = http_response.status
628
+ response_content = http_response.body
629
+ unless status_code == 200
630
+ error_model = JSON.load(response_content)
631
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
632
+ end
633
+
634
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
635
+ # Deserialize Response
636
+ if status_code == 200
637
+ begin
638
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
639
+ result_mapper = Azure::ARM::ContainerRegistry::Models::EventListResult.mapper()
640
+ result.body = @client.deserialize(result_mapper, parsed_response)
641
+ rescue Exception => e
642
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
643
+ end
644
+ end
645
+
646
+ result
647
+ end
648
+
649
+ promise.execute
650
+ end
651
+
652
+ #
653
+ # Creates a webhook for a container registry with the specified parameters.
654
+ #
655
+ # @param resource_group_name [String] The name of the resource group to which
656
+ # the container registry belongs.
657
+ # @param registry_name [String] The name of the container registry.
658
+ # @param webhook_name [String] The name of the webhook.
659
+ # @param webhook_create_parameters [WebhookCreateParameters] The parameters for
660
+ # creating a webhook.
661
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
662
+ # will be added to the HTTP request.
663
+ #
664
+ # @return [Webhook] operation results.
665
+ #
666
+ def begin_create(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers = nil)
667
+ response = begin_create_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers).value!
668
+ response.body unless response.nil?
669
+ end
670
+
671
+ #
672
+ # Creates a webhook for a container registry with the specified parameters.
673
+ #
674
+ # @param resource_group_name [String] The name of the resource group to which
675
+ # the container registry belongs.
676
+ # @param registry_name [String] The name of the container registry.
677
+ # @param webhook_name [String] The name of the webhook.
678
+ # @param webhook_create_parameters [WebhookCreateParameters] The parameters for
679
+ # creating a webhook.
680
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
681
+ # will be added to the HTTP request.
682
+ #
683
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
684
+ #
685
+ def begin_create_with_http_info(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers = nil)
686
+ begin_create_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers).value!
687
+ end
688
+
689
+ #
690
+ # Creates a webhook for a container registry with the specified parameters.
691
+ #
692
+ # @param resource_group_name [String] The name of the resource group to which
693
+ # the container registry belongs.
694
+ # @param registry_name [String] The name of the container registry.
695
+ # @param webhook_name [String] The name of the webhook.
696
+ # @param webhook_create_parameters [WebhookCreateParameters] The parameters for
697
+ # creating a webhook.
698
+ # @param [Hash{String => String}] A hash of custom headers that will be added
699
+ # to the HTTP request.
700
+ #
701
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
702
+ #
703
+ def begin_create_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers = nil)
704
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
705
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
706
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
707
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
708
+ fail ArgumentError, 'webhook_name is nil' if webhook_name.nil?
709
+ fail ArgumentError, 'webhook_create_parameters is nil' if webhook_create_parameters.nil?
710
+
711
+
712
+ request_headers = {}
713
+
714
+ # Set Headers
715
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
716
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
717
+
718
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
719
+
720
+ # Serialize Request
721
+ request_mapper = Azure::ARM::ContainerRegistry::Models::WebhookCreateParameters.mapper()
722
+ request_content = @client.serialize(request_mapper, webhook_create_parameters)
723
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
724
+
725
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'
726
+
727
+ request_url = @base_url || @client.base_url
728
+
729
+ options = {
730
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
731
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'webhookName' => webhook_name},
732
+ query_params: {'api-version' => @client.api_version},
733
+ body: request_content,
734
+ headers: request_headers.merge(custom_headers || {}),
735
+ base_url: request_url
736
+ }
737
+ promise = @client.make_request_async(:put, path_template, options)
738
+
739
+ promise = promise.then do |result|
740
+ http_response = result.response
741
+ status_code = http_response.status
742
+ response_content = http_response.body
743
+ unless status_code == 200 || status_code == 201
744
+ error_model = JSON.load(response_content)
745
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
746
+ end
747
+
748
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
749
+ # Deserialize Response
750
+ if status_code == 200
751
+ begin
752
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
753
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Webhook.mapper()
754
+ result.body = @client.deserialize(result_mapper, parsed_response)
755
+ rescue Exception => e
756
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
757
+ end
758
+ end
759
+ # Deserialize Response
760
+ if status_code == 201
761
+ begin
762
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
763
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Webhook.mapper()
764
+ result.body = @client.deserialize(result_mapper, parsed_response)
765
+ rescue Exception => e
766
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
767
+ end
768
+ end
769
+
770
+ result
771
+ end
772
+
773
+ promise.execute
774
+ end
775
+
776
+ #
777
+ # Deletes a webhook from a container registry.
778
+ #
779
+ # @param resource_group_name [String] The name of the resource group to which
780
+ # the container registry belongs.
781
+ # @param registry_name [String] The name of the container registry.
782
+ # @param webhook_name [String] The name of the webhook.
783
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
784
+ # will be added to the HTTP request.
785
+ #
786
+ #
787
+ def begin_delete(resource_group_name, registry_name, webhook_name, custom_headers = nil)
788
+ response = begin_delete_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
789
+ nil
790
+ end
791
+
792
+ #
793
+ # Deletes a webhook from a container registry.
794
+ #
795
+ # @param resource_group_name [String] The name of the resource group to which
796
+ # the container registry belongs.
797
+ # @param registry_name [String] The name of the container registry.
798
+ # @param webhook_name [String] The name of the webhook.
799
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
800
+ # will be added to the HTTP request.
801
+ #
802
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
803
+ #
804
+ def begin_delete_with_http_info(resource_group_name, registry_name, webhook_name, custom_headers = nil)
805
+ begin_delete_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
806
+ end
807
+
808
+ #
809
+ # Deletes a webhook from a container registry.
810
+ #
811
+ # @param resource_group_name [String] The name of the resource group to which
812
+ # the container registry belongs.
813
+ # @param registry_name [String] The name of the container registry.
814
+ # @param webhook_name [String] The name of the webhook.
815
+ # @param [Hash{String => String}] A hash of custom headers that will be added
816
+ # to the HTTP request.
817
+ #
818
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
819
+ #
820
+ def begin_delete_async(resource_group_name, registry_name, webhook_name, custom_headers = nil)
821
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
822
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
823
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
824
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
825
+ fail ArgumentError, 'webhook_name is nil' if webhook_name.nil?
826
+
827
+
828
+ request_headers = {}
829
+
830
+ # Set Headers
831
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
832
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
833
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'
834
+
835
+ request_url = @base_url || @client.base_url
836
+
837
+ options = {
838
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
839
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'webhookName' => webhook_name},
840
+ query_params: {'api-version' => @client.api_version},
841
+ headers: request_headers.merge(custom_headers || {}),
842
+ base_url: request_url
843
+ }
844
+ promise = @client.make_request_async(:delete, path_template, options)
845
+
846
+ promise = promise.then do |result|
847
+ http_response = result.response
848
+ status_code = http_response.status
849
+ response_content = http_response.body
850
+ unless status_code == 200 || status_code == 202 || status_code == 204
851
+ error_model = JSON.load(response_content)
852
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
853
+ end
854
+
855
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
856
+
857
+ result
858
+ end
859
+
860
+ promise.execute
861
+ end
862
+
863
+ #
864
+ # Updates a webhook with the specified parameters.
865
+ #
866
+ # @param resource_group_name [String] The name of the resource group to which
867
+ # the container registry belongs.
868
+ # @param registry_name [String] The name of the container registry.
869
+ # @param webhook_name [String] The name of the webhook.
870
+ # @param webhook_update_parameters [WebhookUpdateParameters] The parameters for
871
+ # updating a webhook.
872
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
873
+ # will be added to the HTTP request.
874
+ #
875
+ # @return [Webhook] operation results.
876
+ #
877
+ def begin_update(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers = nil)
878
+ response = begin_update_async(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers).value!
879
+ response.body unless response.nil?
880
+ end
881
+
882
+ #
883
+ # Updates a webhook with the specified parameters.
884
+ #
885
+ # @param resource_group_name [String] The name of the resource group to which
886
+ # the container registry belongs.
887
+ # @param registry_name [String] The name of the container registry.
888
+ # @param webhook_name [String] The name of the webhook.
889
+ # @param webhook_update_parameters [WebhookUpdateParameters] The parameters for
890
+ # updating a webhook.
891
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
892
+ # will be added to the HTTP request.
893
+ #
894
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
895
+ #
896
+ def begin_update_with_http_info(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers = nil)
897
+ begin_update_async(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers).value!
898
+ end
899
+
900
+ #
901
+ # Updates a webhook with the specified parameters.
902
+ #
903
+ # @param resource_group_name [String] The name of the resource group to which
904
+ # the container registry belongs.
905
+ # @param registry_name [String] The name of the container registry.
906
+ # @param webhook_name [String] The name of the webhook.
907
+ # @param webhook_update_parameters [WebhookUpdateParameters] The parameters for
908
+ # updating a webhook.
909
+ # @param [Hash{String => String}] A hash of custom headers that will be added
910
+ # to the HTTP request.
911
+ #
912
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
913
+ #
914
+ def begin_update_async(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers = nil)
915
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
916
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
917
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
918
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
919
+ fail ArgumentError, 'webhook_name is nil' if webhook_name.nil?
920
+ fail ArgumentError, 'webhook_update_parameters is nil' if webhook_update_parameters.nil?
921
+
922
+
923
+ request_headers = {}
924
+
925
+ # Set Headers
926
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
927
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
928
+
929
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
930
+
931
+ # Serialize Request
932
+ request_mapper = Azure::ARM::ContainerRegistry::Models::WebhookUpdateParameters.mapper()
933
+ request_content = @client.serialize(request_mapper, webhook_update_parameters)
934
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
935
+
936
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'
937
+
938
+ request_url = @base_url || @client.base_url
939
+
940
+ options = {
941
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
942
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'webhookName' => webhook_name},
943
+ query_params: {'api-version' => @client.api_version},
944
+ body: request_content,
945
+ headers: request_headers.merge(custom_headers || {}),
946
+ base_url: request_url
947
+ }
948
+ promise = @client.make_request_async(:patch, path_template, options)
949
+
950
+ promise = promise.then do |result|
951
+ http_response = result.response
952
+ status_code = http_response.status
953
+ response_content = http_response.body
954
+ unless status_code == 200 || status_code == 201
955
+ error_model = JSON.load(response_content)
956
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
957
+ end
958
+
959
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
960
+ # Deserialize Response
961
+ if status_code == 200
962
+ begin
963
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
964
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Webhook.mapper()
965
+ result.body = @client.deserialize(result_mapper, parsed_response)
966
+ rescue Exception => e
967
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
968
+ end
969
+ end
970
+ # Deserialize Response
971
+ if status_code == 201
972
+ begin
973
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
974
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Webhook.mapper()
975
+ result.body = @client.deserialize(result_mapper, parsed_response)
976
+ rescue Exception => e
977
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
978
+ end
979
+ end
980
+
981
+ result
982
+ end
983
+
984
+ promise.execute
985
+ end
986
+
987
+ #
988
+ # Lists all the webhooks for the specified container registry.
989
+ #
990
+ # @param next_page_link [String] The NextLink from the previous successful call
991
+ # to List operation.
992
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
993
+ # will be added to the HTTP request.
994
+ #
995
+ # @return [WebhookListResult] operation results.
996
+ #
997
+ def list_next(next_page_link, custom_headers = nil)
998
+ response = list_next_async(next_page_link, custom_headers).value!
999
+ response.body unless response.nil?
1000
+ end
1001
+
1002
+ #
1003
+ # Lists all the webhooks for the specified container registry.
1004
+ #
1005
+ # @param next_page_link [String] The NextLink from the previous successful call
1006
+ # to List operation.
1007
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1008
+ # will be added to the HTTP request.
1009
+ #
1010
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1011
+ #
1012
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
1013
+ list_next_async(next_page_link, custom_headers).value!
1014
+ end
1015
+
1016
+ #
1017
+ # Lists all the webhooks for the specified container registry.
1018
+ #
1019
+ # @param next_page_link [String] The NextLink from the previous successful call
1020
+ # to List operation.
1021
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1022
+ # to the HTTP request.
1023
+ #
1024
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1025
+ #
1026
+ def list_next_async(next_page_link, custom_headers = nil)
1027
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1028
+
1029
+
1030
+ request_headers = {}
1031
+
1032
+ # Set Headers
1033
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1034
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1035
+ path_template = '{nextLink}'
1036
+
1037
+ request_url = @base_url || @client.base_url
1038
+
1039
+ options = {
1040
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1041
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1042
+ headers: request_headers.merge(custom_headers || {}),
1043
+ base_url: request_url
1044
+ }
1045
+ promise = @client.make_request_async(:get, path_template, options)
1046
+
1047
+ promise = promise.then do |result|
1048
+ http_response = result.response
1049
+ status_code = http_response.status
1050
+ response_content = http_response.body
1051
+ unless status_code == 200
1052
+ error_model = JSON.load(response_content)
1053
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1054
+ end
1055
+
1056
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1057
+ # Deserialize Response
1058
+ if status_code == 200
1059
+ begin
1060
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1061
+ result_mapper = Azure::ARM::ContainerRegistry::Models::WebhookListResult.mapper()
1062
+ result.body = @client.deserialize(result_mapper, parsed_response)
1063
+ rescue Exception => e
1064
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1065
+ end
1066
+ end
1067
+
1068
+ result
1069
+ end
1070
+
1071
+ promise.execute
1072
+ end
1073
+
1074
+ #
1075
+ # Lists recent events for the specified webhook.
1076
+ #
1077
+ # @param next_page_link [String] The NextLink from the previous successful call
1078
+ # to List operation.
1079
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1080
+ # will be added to the HTTP request.
1081
+ #
1082
+ # @return [EventListResult] operation results.
1083
+ #
1084
+ def list_events_next(next_page_link, custom_headers = nil)
1085
+ response = list_events_next_async(next_page_link, custom_headers).value!
1086
+ response.body unless response.nil?
1087
+ end
1088
+
1089
+ #
1090
+ # Lists recent events for the specified webhook.
1091
+ #
1092
+ # @param next_page_link [String] The NextLink from the previous successful call
1093
+ # to List operation.
1094
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1095
+ # will be added to the HTTP request.
1096
+ #
1097
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1098
+ #
1099
+ def list_events_next_with_http_info(next_page_link, custom_headers = nil)
1100
+ list_events_next_async(next_page_link, custom_headers).value!
1101
+ end
1102
+
1103
+ #
1104
+ # Lists recent events for the specified webhook.
1105
+ #
1106
+ # @param next_page_link [String] The NextLink from the previous successful call
1107
+ # to List operation.
1108
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1109
+ # to the HTTP request.
1110
+ #
1111
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1112
+ #
1113
+ def list_events_next_async(next_page_link, custom_headers = nil)
1114
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1115
+
1116
+
1117
+ request_headers = {}
1118
+
1119
+ # Set Headers
1120
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1121
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1122
+ path_template = '{nextLink}'
1123
+
1124
+ request_url = @base_url || @client.base_url
1125
+
1126
+ options = {
1127
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1128
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1129
+ headers: request_headers.merge(custom_headers || {}),
1130
+ base_url: request_url
1131
+ }
1132
+ promise = @client.make_request_async(:post, path_template, options)
1133
+
1134
+ promise = promise.then do |result|
1135
+ http_response = result.response
1136
+ status_code = http_response.status
1137
+ response_content = http_response.body
1138
+ unless status_code == 200
1139
+ error_model = JSON.load(response_content)
1140
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1141
+ end
1142
+
1143
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1144
+ # Deserialize Response
1145
+ if status_code == 200
1146
+ begin
1147
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1148
+ result_mapper = Azure::ARM::ContainerRegistry::Models::EventListResult.mapper()
1149
+ result.body = @client.deserialize(result_mapper, parsed_response)
1150
+ rescue Exception => e
1151
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1152
+ end
1153
+ end
1154
+
1155
+ result
1156
+ end
1157
+
1158
+ promise.execute
1159
+ end
1160
+
1161
+ #
1162
+ # Lists all the webhooks for the specified container registry.
1163
+ #
1164
+ # @param resource_group_name [String] The name of the resource group to which
1165
+ # the container registry belongs.
1166
+ # @param registry_name [String] The name of the container registry.
1167
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1168
+ # will be added to the HTTP request.
1169
+ #
1170
+ # @return [WebhookListResult] which provide lazy access to pages of the
1171
+ # response.
1172
+ #
1173
+ def list_as_lazy(resource_group_name, registry_name, custom_headers = nil)
1174
+ response = list_async(resource_group_name, registry_name, custom_headers).value!
1175
+ unless response.nil?
1176
+ page = response.body
1177
+ page.next_method = Proc.new do |next_page_link|
1178
+ list_next_async(next_page_link, custom_headers)
1179
+ end
1180
+ page
1181
+ end
1182
+ end
1183
+
1184
+ #
1185
+ # Lists recent events for the specified webhook.
1186
+ #
1187
+ # @param resource_group_name [String] The name of the resource group to which
1188
+ # the container registry belongs.
1189
+ # @param registry_name [String] The name of the container registry.
1190
+ # @param webhook_name [String] The name of the webhook.
1191
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1192
+ # will be added to the HTTP request.
1193
+ #
1194
+ # @return [EventListResult] which provide lazy access to pages of the response.
1195
+ #
1196
+ def list_events_as_lazy(resource_group_name, registry_name, webhook_name, custom_headers = nil)
1197
+ response = list_events_async(resource_group_name, registry_name, webhook_name, custom_headers).value!
1198
+ unless response.nil?
1199
+ page = response.body
1200
+ page.next_method = Proc.new do |next_page_link|
1201
+ list_events_next_async(next_page_link, custom_headers)
1202
+ end
1203
+ page
1204
+ end
1205
+ end
1206
+
1207
+ end
1208
+ end