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,799 @@
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
+ # Replications
9
+ #
10
+ class Replications
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Replications 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 replication.
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 replication_name [String] The name of the replication.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [Replication] operation results.
35
+ #
36
+ def get(resource_group_name, registry_name, replication_name, custom_headers = nil)
37
+ response = get_async(resource_group_name, registry_name, replication_name, custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Gets the properties of the specified replication.
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 replication_name [String] The name of the replication.
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, replication_name, custom_headers = nil)
54
+ get_async(resource_group_name, registry_name, replication_name, custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Gets the properties of the specified replication.
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 replication_name [String] The name of the replication.
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, replication_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, 'replication_name is nil' if replication_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}/replications/{replicationName}'
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,'replicationName' => replication_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::Replication.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 replication 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 replication_name [String] The name of the replication.
129
+ # @param replication [Replication] The parameters for creating a replication.
130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
131
+ # will be added to the HTTP request.
132
+ #
133
+ # @return [Replication] operation results.
134
+ #
135
+ def create(resource_group_name, registry_name, replication_name, replication, custom_headers = nil)
136
+ response = create_async(resource_group_name, registry_name, replication_name, replication, custom_headers).value!
137
+ response.body unless response.nil?
138
+ end
139
+
140
+ #
141
+ # @param resource_group_name [String] The name of the resource group to which
142
+ # the container registry belongs.
143
+ # @param registry_name [String] The name of the container registry.
144
+ # @param replication_name [String] The name of the replication.
145
+ # @param replication [Replication] The parameters for creating a replication.
146
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
147
+ # will be added to the HTTP request.
148
+ #
149
+ # @return [Concurrent::Promise] promise which provides async access to http
150
+ # response.
151
+ #
152
+ def create_async(resource_group_name, registry_name, replication_name, replication, custom_headers = nil)
153
+ # Send request
154
+ promise = begin_create_async(resource_group_name, registry_name, replication_name, replication, custom_headers)
155
+
156
+ promise = promise.then do |response|
157
+ # Defining deserialization method.
158
+ deserialize_method = lambda do |parsed_response|
159
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Replication.mapper()
160
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
161
+ end
162
+
163
+ # Waiting for response.
164
+ @client.get_long_running_operation_result(response, deserialize_method)
165
+ end
166
+
167
+ promise
168
+ end
169
+
170
+ #
171
+ # Deletes a replication from a container registry.
172
+ #
173
+ # @param resource_group_name [String] The name of the resource group to which
174
+ # the container registry belongs.
175
+ # @param registry_name [String] The name of the container registry.
176
+ # @param replication_name [String] The name of the replication.
177
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
178
+ # will be added to the HTTP request.
179
+ #
180
+ def delete(resource_group_name, registry_name, replication_name, custom_headers = nil)
181
+ response = delete_async(resource_group_name, registry_name, replication_name, custom_headers).value!
182
+ nil
183
+ end
184
+
185
+ #
186
+ # @param resource_group_name [String] The name of the resource group to which
187
+ # the container registry belongs.
188
+ # @param registry_name [String] The name of the container registry.
189
+ # @param replication_name [String] The name of the replication.
190
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
191
+ # will be added to the HTTP request.
192
+ #
193
+ # @return [Concurrent::Promise] promise which provides async access to http
194
+ # response.
195
+ #
196
+ def delete_async(resource_group_name, registry_name, replication_name, custom_headers = nil)
197
+ # Send request
198
+ promise = begin_delete_async(resource_group_name, registry_name, replication_name, custom_headers)
199
+
200
+ promise = promise.then do |response|
201
+ # Defining deserialization method.
202
+ deserialize_method = lambda do |parsed_response|
203
+ end
204
+
205
+ # Waiting for response.
206
+ @client.get_long_running_operation_result(response, deserialize_method)
207
+ end
208
+
209
+ promise
210
+ end
211
+
212
+ #
213
+ # Updates a replication for a container registry with the specified parameters.
214
+ #
215
+ # @param resource_group_name [String] The name of the resource group to which
216
+ # the container registry belongs.
217
+ # @param registry_name [String] The name of the container registry.
218
+ # @param replication_name [String] The name of the replication.
219
+ # @param replication_update_parameters [ReplicationUpdateParameters] The
220
+ # parameters for updating a replication.
221
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
222
+ # will be added to the HTTP request.
223
+ #
224
+ # @return [Replication] operation results.
225
+ #
226
+ def update(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers = nil)
227
+ response = update_async(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers).value!
228
+ response.body unless response.nil?
229
+ end
230
+
231
+ #
232
+ # @param resource_group_name [String] The name of the resource group to which
233
+ # the container registry belongs.
234
+ # @param registry_name [String] The name of the container registry.
235
+ # @param replication_name [String] The name of the replication.
236
+ # @param replication_update_parameters [ReplicationUpdateParameters] The
237
+ # parameters for updating a replication.
238
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
239
+ # will be added to the HTTP request.
240
+ #
241
+ # @return [Concurrent::Promise] promise which provides async access to http
242
+ # response.
243
+ #
244
+ def update_async(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers = nil)
245
+ # Send request
246
+ promise = begin_update_async(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers)
247
+
248
+ promise = promise.then do |response|
249
+ # Defining deserialization method.
250
+ deserialize_method = lambda do |parsed_response|
251
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Replication.mapper()
252
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
253
+ end
254
+
255
+ # Waiting for response.
256
+ @client.get_long_running_operation_result(response, deserialize_method)
257
+ end
258
+
259
+ promise
260
+ end
261
+
262
+ #
263
+ # Lists all the replications for the specified container registry.
264
+ #
265
+ # @param resource_group_name [String] The name of the resource group to which
266
+ # the container registry belongs.
267
+ # @param registry_name [String] The name of the container registry.
268
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
269
+ # will be added to the HTTP request.
270
+ #
271
+ # @return [Array<Replication>] operation results.
272
+ #
273
+ def list(resource_group_name, registry_name, custom_headers = nil)
274
+ first_page = list_as_lazy(resource_group_name, registry_name, custom_headers)
275
+ first_page.get_all_items
276
+ end
277
+
278
+ #
279
+ # Lists all the replications for the specified container registry.
280
+ #
281
+ # @param resource_group_name [String] The name of the resource group to which
282
+ # the container registry belongs.
283
+ # @param registry_name [String] The name of the container registry.
284
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
285
+ # will be added to the HTTP request.
286
+ #
287
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
288
+ #
289
+ def list_with_http_info(resource_group_name, registry_name, custom_headers = nil)
290
+ list_async(resource_group_name, registry_name, custom_headers).value!
291
+ end
292
+
293
+ #
294
+ # Lists all the replications for the specified container registry.
295
+ #
296
+ # @param resource_group_name [String] The name of the resource group to which
297
+ # the container registry belongs.
298
+ # @param registry_name [String] The name of the container registry.
299
+ # @param [Hash{String => String}] A hash of custom headers that will be added
300
+ # to the HTTP request.
301
+ #
302
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
303
+ #
304
+ def list_async(resource_group_name, registry_name, custom_headers = nil)
305
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
306
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
307
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
308
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
309
+
310
+
311
+ request_headers = {}
312
+
313
+ # Set Headers
314
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
315
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
316
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications'
317
+
318
+ request_url = @base_url || @client.base_url
319
+
320
+ options = {
321
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
322
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
323
+ query_params: {'api-version' => @client.api_version},
324
+ headers: request_headers.merge(custom_headers || {}),
325
+ base_url: request_url
326
+ }
327
+ promise = @client.make_request_async(:get, path_template, options)
328
+
329
+ promise = promise.then do |result|
330
+ http_response = result.response
331
+ status_code = http_response.status
332
+ response_content = http_response.body
333
+ unless status_code == 200
334
+ error_model = JSON.load(response_content)
335
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
336
+ end
337
+
338
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
339
+ # Deserialize Response
340
+ if status_code == 200
341
+ begin
342
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
343
+ result_mapper = Azure::ARM::ContainerRegistry::Models::ReplicationListResult.mapper()
344
+ result.body = @client.deserialize(result_mapper, parsed_response)
345
+ rescue Exception => e
346
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
347
+ end
348
+ end
349
+
350
+ result
351
+ end
352
+
353
+ promise.execute
354
+ end
355
+
356
+ #
357
+ # Creates a replication for a container registry with the specified parameters.
358
+ #
359
+ # @param resource_group_name [String] The name of the resource group to which
360
+ # the container registry belongs.
361
+ # @param registry_name [String] The name of the container registry.
362
+ # @param replication_name [String] The name of the replication.
363
+ # @param replication [Replication] The parameters for creating a replication.
364
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
365
+ # will be added to the HTTP request.
366
+ #
367
+ # @return [Replication] operation results.
368
+ #
369
+ def begin_create(resource_group_name, registry_name, replication_name, replication, custom_headers = nil)
370
+ response = begin_create_async(resource_group_name, registry_name, replication_name, replication, custom_headers).value!
371
+ response.body unless response.nil?
372
+ end
373
+
374
+ #
375
+ # Creates a replication for a container registry with the specified parameters.
376
+ #
377
+ # @param resource_group_name [String] The name of the resource group to which
378
+ # the container registry belongs.
379
+ # @param registry_name [String] The name of the container registry.
380
+ # @param replication_name [String] The name of the replication.
381
+ # @param replication [Replication] The parameters for creating a replication.
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 begin_create_with_http_info(resource_group_name, registry_name, replication_name, replication, custom_headers = nil)
388
+ begin_create_async(resource_group_name, registry_name, replication_name, replication, custom_headers).value!
389
+ end
390
+
391
+ #
392
+ # Creates a replication for a container registry with the specified parameters.
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 replication_name [String] The name of the replication.
398
+ # @param replication [Replication] The parameters for creating a replication.
399
+ # @param [Hash{String => String}] A hash of custom headers that will be added
400
+ # to the HTTP request.
401
+ #
402
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
403
+ #
404
+ def begin_create_async(resource_group_name, registry_name, replication_name, replication, custom_headers = nil)
405
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
406
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
407
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
408
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
409
+ fail ArgumentError, 'replication_name is nil' if replication_name.nil?
410
+ fail ArgumentError, 'replication is nil' if replication.nil?
411
+
412
+
413
+ request_headers = {}
414
+
415
+ # Set Headers
416
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
417
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
418
+
419
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
420
+
421
+ # Serialize Request
422
+ request_mapper = Azure::ARM::ContainerRegistry::Models::Replication.mapper()
423
+ request_content = @client.serialize(request_mapper, replication)
424
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
425
+
426
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'
427
+
428
+ request_url = @base_url || @client.base_url
429
+
430
+ options = {
431
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
432
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'replicationName' => replication_name},
433
+ query_params: {'api-version' => @client.api_version},
434
+ body: request_content,
435
+ headers: request_headers.merge(custom_headers || {}),
436
+ base_url: request_url
437
+ }
438
+ promise = @client.make_request_async(:put, path_template, options)
439
+
440
+ promise = promise.then do |result|
441
+ http_response = result.response
442
+ status_code = http_response.status
443
+ response_content = http_response.body
444
+ unless status_code == 200 || status_code == 201
445
+ error_model = JSON.load(response_content)
446
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
447
+ end
448
+
449
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
450
+ # Deserialize Response
451
+ if status_code == 200
452
+ begin
453
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
454
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Replication.mapper()
455
+ result.body = @client.deserialize(result_mapper, parsed_response)
456
+ rescue Exception => e
457
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
458
+ end
459
+ end
460
+ # Deserialize Response
461
+ if status_code == 201
462
+ begin
463
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
464
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Replication.mapper()
465
+ result.body = @client.deserialize(result_mapper, parsed_response)
466
+ rescue Exception => e
467
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
468
+ end
469
+ end
470
+
471
+ result
472
+ end
473
+
474
+ promise.execute
475
+ end
476
+
477
+ #
478
+ # Deletes a replication from a container registry.
479
+ #
480
+ # @param resource_group_name [String] The name of the resource group to which
481
+ # the container registry belongs.
482
+ # @param registry_name [String] The name of the container registry.
483
+ # @param replication_name [String] The name of the replication.
484
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
485
+ # will be added to the HTTP request.
486
+ #
487
+ #
488
+ def begin_delete(resource_group_name, registry_name, replication_name, custom_headers = nil)
489
+ response = begin_delete_async(resource_group_name, registry_name, replication_name, custom_headers).value!
490
+ nil
491
+ end
492
+
493
+ #
494
+ # Deletes a replication from a container registry.
495
+ #
496
+ # @param resource_group_name [String] The name of the resource group to which
497
+ # the container registry belongs.
498
+ # @param registry_name [String] The name of the container registry.
499
+ # @param replication_name [String] The name of the replication.
500
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
501
+ # will be added to the HTTP request.
502
+ #
503
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
504
+ #
505
+ def begin_delete_with_http_info(resource_group_name, registry_name, replication_name, custom_headers = nil)
506
+ begin_delete_async(resource_group_name, registry_name, replication_name, custom_headers).value!
507
+ end
508
+
509
+ #
510
+ # Deletes a replication from a container registry.
511
+ #
512
+ # @param resource_group_name [String] The name of the resource group to which
513
+ # the container registry belongs.
514
+ # @param registry_name [String] The name of the container registry.
515
+ # @param replication_name [String] The name of the replication.
516
+ # @param [Hash{String => String}] A hash of custom headers that will be added
517
+ # to the HTTP request.
518
+ #
519
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
520
+ #
521
+ def begin_delete_async(resource_group_name, registry_name, replication_name, custom_headers = nil)
522
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
523
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
524
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
525
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
526
+ fail ArgumentError, 'replication_name is nil' if replication_name.nil?
527
+
528
+
529
+ request_headers = {}
530
+
531
+ # Set Headers
532
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
533
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
534
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'
535
+
536
+ request_url = @base_url || @client.base_url
537
+
538
+ options = {
539
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
540
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'replicationName' => replication_name},
541
+ query_params: {'api-version' => @client.api_version},
542
+ headers: request_headers.merge(custom_headers || {}),
543
+ base_url: request_url
544
+ }
545
+ promise = @client.make_request_async(:delete, path_template, options)
546
+
547
+ promise = promise.then do |result|
548
+ http_response = result.response
549
+ status_code = http_response.status
550
+ response_content = http_response.body
551
+ unless status_code == 200 || status_code == 202 || status_code == 204
552
+ error_model = JSON.load(response_content)
553
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
554
+ end
555
+
556
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
557
+
558
+ result
559
+ end
560
+
561
+ promise.execute
562
+ end
563
+
564
+ #
565
+ # Updates a replication for a container registry with the specified parameters.
566
+ #
567
+ # @param resource_group_name [String] The name of the resource group to which
568
+ # the container registry belongs.
569
+ # @param registry_name [String] The name of the container registry.
570
+ # @param replication_name [String] The name of the replication.
571
+ # @param replication_update_parameters [ReplicationUpdateParameters] The
572
+ # parameters for updating a replication.
573
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
574
+ # will be added to the HTTP request.
575
+ #
576
+ # @return [Replication] operation results.
577
+ #
578
+ def begin_update(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers = nil)
579
+ response = begin_update_async(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers).value!
580
+ response.body unless response.nil?
581
+ end
582
+
583
+ #
584
+ # Updates a replication for a container registry with the specified parameters.
585
+ #
586
+ # @param resource_group_name [String] The name of the resource group to which
587
+ # the container registry belongs.
588
+ # @param registry_name [String] The name of the container registry.
589
+ # @param replication_name [String] The name of the replication.
590
+ # @param replication_update_parameters [ReplicationUpdateParameters] The
591
+ # parameters for updating a replication.
592
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
593
+ # will be added to the HTTP request.
594
+ #
595
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
596
+ #
597
+ def begin_update_with_http_info(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers = nil)
598
+ begin_update_async(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers).value!
599
+ end
600
+
601
+ #
602
+ # Updates a replication for a container registry with the specified parameters.
603
+ #
604
+ # @param resource_group_name [String] The name of the resource group to which
605
+ # the container registry belongs.
606
+ # @param registry_name [String] The name of the container registry.
607
+ # @param replication_name [String] The name of the replication.
608
+ # @param replication_update_parameters [ReplicationUpdateParameters] The
609
+ # parameters for updating a replication.
610
+ # @param [Hash{String => String}] A hash of custom headers that will be added
611
+ # to the HTTP request.
612
+ #
613
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
614
+ #
615
+ def begin_update_async(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers = nil)
616
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
617
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
618
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
619
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
620
+ fail ArgumentError, 'replication_name is nil' if replication_name.nil?
621
+ fail ArgumentError, 'replication_update_parameters is nil' if replication_update_parameters.nil?
622
+
623
+
624
+ request_headers = {}
625
+
626
+ # Set Headers
627
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
628
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
629
+
630
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
631
+
632
+ # Serialize Request
633
+ request_mapper = Azure::ARM::ContainerRegistry::Models::ReplicationUpdateParameters.mapper()
634
+ request_content = @client.serialize(request_mapper, replication_update_parameters)
635
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
636
+
637
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'
638
+
639
+ request_url = @base_url || @client.base_url
640
+
641
+ options = {
642
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
643
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'replicationName' => replication_name},
644
+ query_params: {'api-version' => @client.api_version},
645
+ body: request_content,
646
+ headers: request_headers.merge(custom_headers || {}),
647
+ base_url: request_url
648
+ }
649
+ promise = @client.make_request_async(:patch, path_template, options)
650
+
651
+ promise = promise.then do |result|
652
+ http_response = result.response
653
+ status_code = http_response.status
654
+ response_content = http_response.body
655
+ unless status_code == 200 || status_code == 201
656
+ error_model = JSON.load(response_content)
657
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
658
+ end
659
+
660
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
661
+ # Deserialize Response
662
+ if status_code == 200
663
+ begin
664
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
665
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Replication.mapper()
666
+ result.body = @client.deserialize(result_mapper, parsed_response)
667
+ rescue Exception => e
668
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
669
+ end
670
+ end
671
+ # Deserialize Response
672
+ if status_code == 201
673
+ begin
674
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
675
+ result_mapper = Azure::ARM::ContainerRegistry::Models::Replication.mapper()
676
+ result.body = @client.deserialize(result_mapper, parsed_response)
677
+ rescue Exception => e
678
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
679
+ end
680
+ end
681
+
682
+ result
683
+ end
684
+
685
+ promise.execute
686
+ end
687
+
688
+ #
689
+ # Lists all the replications for the specified container registry.
690
+ #
691
+ # @param next_page_link [String] The NextLink from the previous successful call
692
+ # to List operation.
693
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
694
+ # will be added to the HTTP request.
695
+ #
696
+ # @return [ReplicationListResult] operation results.
697
+ #
698
+ def list_next(next_page_link, custom_headers = nil)
699
+ response = list_next_async(next_page_link, custom_headers).value!
700
+ response.body unless response.nil?
701
+ end
702
+
703
+ #
704
+ # Lists all the replications for the specified container registry.
705
+ #
706
+ # @param next_page_link [String] The NextLink from the previous successful call
707
+ # to List operation.
708
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
709
+ # will be added to the HTTP request.
710
+ #
711
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
712
+ #
713
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
714
+ list_next_async(next_page_link, custom_headers).value!
715
+ end
716
+
717
+ #
718
+ # Lists all the replications for the specified container registry.
719
+ #
720
+ # @param next_page_link [String] The NextLink from the previous successful call
721
+ # to List operation.
722
+ # @param [Hash{String => String}] A hash of custom headers that will be added
723
+ # to the HTTP request.
724
+ #
725
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
726
+ #
727
+ def list_next_async(next_page_link, custom_headers = nil)
728
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
729
+
730
+
731
+ request_headers = {}
732
+
733
+ # Set Headers
734
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
735
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
736
+ path_template = '{nextLink}'
737
+
738
+ request_url = @base_url || @client.base_url
739
+
740
+ options = {
741
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
742
+ skip_encoding_path_params: {'nextLink' => next_page_link},
743
+ headers: request_headers.merge(custom_headers || {}),
744
+ base_url: request_url
745
+ }
746
+ promise = @client.make_request_async(:get, path_template, options)
747
+
748
+ promise = promise.then do |result|
749
+ http_response = result.response
750
+ status_code = http_response.status
751
+ response_content = http_response.body
752
+ unless status_code == 200
753
+ error_model = JSON.load(response_content)
754
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
755
+ end
756
+
757
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
758
+ # Deserialize Response
759
+ if status_code == 200
760
+ begin
761
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
762
+ result_mapper = Azure::ARM::ContainerRegistry::Models::ReplicationListResult.mapper()
763
+ result.body = @client.deserialize(result_mapper, parsed_response)
764
+ rescue Exception => e
765
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
766
+ end
767
+ end
768
+
769
+ result
770
+ end
771
+
772
+ promise.execute
773
+ end
774
+
775
+ #
776
+ # Lists all the replications for the specified container registry.
777
+ #
778
+ # @param resource_group_name [String] The name of the resource group to which
779
+ # the container registry belongs.
780
+ # @param registry_name [String] The name of the container registry.
781
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
782
+ # will be added to the HTTP request.
783
+ #
784
+ # @return [ReplicationListResult] which provide lazy access to pages of the
785
+ # response.
786
+ #
787
+ def list_as_lazy(resource_group_name, registry_name, custom_headers = nil)
788
+ response = list_async(resource_group_name, registry_name, custom_headers).value!
789
+ unless response.nil?
790
+ page = response.body
791
+ page.next_method = Proc.new do |next_page_link|
792
+ list_next_async(next_page_link, custom_headers)
793
+ end
794
+ page
795
+ end
796
+ end
797
+
798
+ end
799
+ end