azure_mgmt_container_registry 0.18.1 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2016-06-27-preview/generated/azure_mgmt_container_registry/container_registry_management_client.rb +1 -1
  3. data/lib/2017-03-01/generated/azure_mgmt_container_registry/container_registry_management_client.rb +1 -1
  4. data/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/container_registry_management_client.rb +1 -1
  5. data/lib/2017-10-01/generated/azure_mgmt_container_registry/container_registry_management_client.rb +1 -1
  6. data/lib/2017-10-01/generated/azure_mgmt_container_registry/models/target.rb +22 -0
  7. data/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/container_registry_management_client.rb +1 -1
  8. data/lib/2018-09-01/generated/azure_mgmt_container_registry.rb +25 -19
  9. data/lib/2018-09-01/generated/azure_mgmt_container_registry/container_registry_management_client.rb +1 -1
  10. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/credentials.rb +74 -0
  11. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/custom_registry_credentials.rb +63 -0
  12. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/docker_build_request.rb +25 -0
  13. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/docker_build_step.rb +12 -0
  14. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/docker_build_step_update_parameters.rb +12 -0
  15. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/encoded_task_run_request.rb +13 -0
  16. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/file_task_run_request.rb +13 -0
  17. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/run.rb +58 -13
  18. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/secret_object.rb +63 -0
  19. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/secret_object_type.rb +15 -0
  20. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/source_registry_credentials.rb +52 -0
  21. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/source_registry_login_mode.rb +16 -0
  22. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/task.rb +13 -0
  23. data/lib/2018-09-01/generated/azure_mgmt_container_registry/models/task_update_parameters.rb +13 -0
  24. data/lib/2019-04-01/generated/azure_mgmt_container_registry.rb +97 -0
  25. data/lib/2019-04-01/generated/azure_mgmt_container_registry/container_registry_management_client.rb +139 -0
  26. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/agent_properties.rb +47 -0
  27. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/architecture.rb +17 -0
  28. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/argument.rb +70 -0
  29. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/auth_info.rb +92 -0
  30. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/auth_info_update_parameters.rb +92 -0
  31. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/base_image_dependency.rb +91 -0
  32. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/base_image_dependency_type.rb +16 -0
  33. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/base_image_trigger.rb +71 -0
  34. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/base_image_trigger_type.rb +16 -0
  35. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/base_image_trigger_update_parameters.rb +71 -0
  36. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/credentials.rb +74 -0
  37. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/custom_registry_credentials.rb +82 -0
  38. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/docker_build_request.rb +218 -0
  39. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/docker_build_step.rb +175 -0
  40. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/docker_build_step_update_parameters.rb +154 -0
  41. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/encoded_task_run_request.rb +172 -0
  42. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/encoded_task_step.rb +129 -0
  43. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/encoded_task_step_update_parameters.rb +111 -0
  44. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/file_task_run_request.rb +172 -0
  45. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/file_task_step.rb +129 -0
  46. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/file_task_step_update_parameters.rb +111 -0
  47. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/identity_properties.rb +95 -0
  48. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/image_descriptor.rb +79 -0
  49. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/image_update_trigger.rb +78 -0
  50. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/os.rb +16 -0
  51. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/platform_properties.rb +71 -0
  52. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/platform_update_parameters.rb +71 -0
  53. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/provisioning_state.rb +20 -0
  54. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/proxy_resource.rb +72 -0
  55. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/resource.rb +111 -0
  56. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/resource_identity_type.rb +18 -0
  57. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/run.rb +297 -0
  58. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/run_filter.rb +129 -0
  59. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/run_get_log_result.rb +47 -0
  60. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/run_list_result.rb +99 -0
  61. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/run_request.rb +62 -0
  62. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/run_status.rb +22 -0
  63. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/run_type.rb +18 -0
  64. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/run_update_parameters.rb +47 -0
  65. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/secret_object.rb +63 -0
  66. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/secret_object_type.rb +16 -0
  67. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/set_value.rb +71 -0
  68. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_control_type.rb +16 -0
  69. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_properties.rb +83 -0
  70. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_registry_credentials.rb +52 -0
  71. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_registry_login_mode.rb +16 -0
  72. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_trigger.rb +92 -0
  73. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_trigger_descriptor.rb +112 -0
  74. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_trigger_event.rb +16 -0
  75. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_trigger_update_parameters.rb +92 -0
  76. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_update_parameters.rb +83 -0
  77. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/source_upload_definition.rb +58 -0
  78. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/task.rb +218 -0
  79. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/task_list_result.rb +99 -0
  80. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/task_run_request.rb +91 -0
  81. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/task_status.rb +16 -0
  82. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/task_step_properties.rb +94 -0
  83. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/task_step_update_parameters.rb +72 -0
  84. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/task_update_parameters.rb +155 -0
  85. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/timer_trigger.rb +70 -0
  86. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/timer_trigger_update_parameters.rb +70 -0
  87. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/token_type.rb +16 -0
  88. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/trigger_properties.rb +89 -0
  89. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/trigger_status.rb +16 -0
  90. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/trigger_update_parameters.rb +90 -0
  91. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/user_identity_properties.rb +58 -0
  92. data/lib/2019-04-01/generated/azure_mgmt_container_registry/models/variant.rb +17 -0
  93. data/lib/2019-04-01/generated/azure_mgmt_container_registry/module_definition.rb +9 -0
  94. data/lib/2019-04-01/generated/azure_mgmt_container_registry/registries.rb +289 -0
  95. data/lib/2019-04-01/generated/azure_mgmt_container_registry/runs.rb +766 -0
  96. data/lib/2019-04-01/generated/azure_mgmt_container_registry/tasks.rb +938 -0
  97. data/lib/azure_mgmt_container_registry.rb +1 -0
  98. data/lib/profiles/latest/modules/containerregistry_profile_module.rb +189 -145
  99. data/lib/version.rb +1 -1
  100. metadata +82 -3
@@ -0,0 +1,938 @@
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::ContainerRegistry::Mgmt::V2019_04_01
7
+ #
8
+ # Tasks
9
+ #
10
+ class Tasks
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Tasks 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
+ # Lists all the tasks for a specified container registry.
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 custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<Task>] operation results.
34
+ #
35
+ def list(resource_group_name, registry_name, custom_headers:nil)
36
+ first_page = list_as_lazy(resource_group_name, registry_name, custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Lists all the tasks for a specified container registry.
42
+ #
43
+ # @param resource_group_name [String] The name of the resource group to which
44
+ # the container registry belongs.
45
+ # @param registry_name [String] The name of the container registry.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_with_http_info(resource_group_name, registry_name, custom_headers:nil)
52
+ list_async(resource_group_name, registry_name, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Lists all the tasks for a specified container registry.
57
+ #
58
+ # @param resource_group_name [String] The name of the resource group to which
59
+ # the container registry belongs.
60
+ # @param registry_name [String] The name of the container registry.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_async(resource_group_name, registry_name, custom_headers:nil)
67
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
68
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
69
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
70
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
71
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
72
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
73
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9]*$'" if !registry_name.nil? && registry_name.match(Regexp.new('^^[a-zA-Z0-9]*$$')).nil?
74
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
75
+
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks'
84
+
85
+ request_url = @base_url || @client.base_url
86
+
87
+ options = {
88
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
90
+ query_params: {'api-version' => @client.api_version},
91
+ headers: request_headers.merge(custom_headers || {}),
92
+ base_url: request_url
93
+ }
94
+ promise = @client.make_request_async(:get, path_template, options)
95
+
96
+ promise = promise.then do |result|
97
+ http_response = result.response
98
+ status_code = http_response.status
99
+ response_content = http_response.body
100
+ unless status_code == 200
101
+ error_model = JSON.load(response_content)
102
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
103
+ end
104
+
105
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
106
+ # Deserialize Response
107
+ if status_code == 200
108
+ begin
109
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
110
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::TaskListResult.mapper()
111
+ result.body = @client.deserialize(result_mapper, parsed_response)
112
+ rescue Exception => e
113
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
114
+ end
115
+ end
116
+
117
+ result
118
+ end
119
+
120
+ promise.execute
121
+ end
122
+
123
+ #
124
+ # Get the properties of a specified task.
125
+ #
126
+ # @param resource_group_name [String] The name of the resource group to which
127
+ # the container registry belongs.
128
+ # @param registry_name [String] The name of the container registry.
129
+ # @param task_name [String] The name of the container registry task.
130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
131
+ # will be added to the HTTP request.
132
+ #
133
+ # @return [Task] operation results.
134
+ #
135
+ def get(resource_group_name, registry_name, task_name, custom_headers:nil)
136
+ response = get_async(resource_group_name, registry_name, task_name, custom_headers:custom_headers).value!
137
+ response.body unless response.nil?
138
+ end
139
+
140
+ #
141
+ # Get the properties of a specified task.
142
+ #
143
+ # @param resource_group_name [String] The name of the resource group to which
144
+ # the container registry belongs.
145
+ # @param registry_name [String] The name of the container registry.
146
+ # @param task_name [String] The name of the container registry task.
147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
148
+ # will be added to the HTTP request.
149
+ #
150
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
151
+ #
152
+ def get_with_http_info(resource_group_name, registry_name, task_name, custom_headers:nil)
153
+ get_async(resource_group_name, registry_name, task_name, custom_headers:custom_headers).value!
154
+ end
155
+
156
+ #
157
+ # Get the properties of a specified task.
158
+ #
159
+ # @param resource_group_name [String] The name of the resource group to which
160
+ # the container registry belongs.
161
+ # @param registry_name [String] The name of the container registry.
162
+ # @param task_name [String] The name of the container registry task.
163
+ # @param [Hash{String => String}] A hash of custom headers that will be added
164
+ # to the HTTP request.
165
+ #
166
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
167
+ #
168
+ def get_async(resource_group_name, registry_name, task_name, custom_headers:nil)
169
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
170
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
171
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
172
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
173
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
174
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
175
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9]*$'" if !registry_name.nil? && registry_name.match(Regexp.new('^^[a-zA-Z0-9]*$$')).nil?
176
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
177
+ fail ArgumentError, 'task_name is nil' if task_name.nil?
178
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MaxLength': '50'" if !task_name.nil? && task_name.length > 50
179
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MinLength': '5'" if !task_name.nil? && task_name.length < 5
180
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9-_]*$'" if !task_name.nil? && task_name.match(Regexp.new('^^[a-zA-Z0-9-_]*$$')).nil?
181
+
182
+
183
+ request_headers = {}
184
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
185
+
186
+ # Set Headers
187
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
188
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
189
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'
190
+
191
+ request_url = @base_url || @client.base_url
192
+
193
+ options = {
194
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
195
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'taskName' => task_name},
196
+ query_params: {'api-version' => @client.api_version},
197
+ headers: request_headers.merge(custom_headers || {}),
198
+ base_url: request_url
199
+ }
200
+ promise = @client.make_request_async(:get, path_template, options)
201
+
202
+ promise = promise.then do |result|
203
+ http_response = result.response
204
+ status_code = http_response.status
205
+ response_content = http_response.body
206
+ unless status_code == 200
207
+ error_model = JSON.load(response_content)
208
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
209
+ end
210
+
211
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
212
+ # Deserialize Response
213
+ if status_code == 200
214
+ begin
215
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
216
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Task.mapper()
217
+ result.body = @client.deserialize(result_mapper, parsed_response)
218
+ rescue Exception => e
219
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
220
+ end
221
+ end
222
+
223
+ result
224
+ end
225
+
226
+ promise.execute
227
+ end
228
+
229
+ #
230
+ # Creates a task for a container registry with the specified parameters.
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 task_name [String] The name of the container registry task.
236
+ # @param task_create_parameters [Task] The parameters for creating a task.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ # @return [Task] operation results.
241
+ #
242
+ def create(resource_group_name, registry_name, task_name, task_create_parameters, custom_headers:nil)
243
+ response = create_async(resource_group_name, registry_name, task_name, task_create_parameters, custom_headers:custom_headers).value!
244
+ response.body unless response.nil?
245
+ end
246
+
247
+ #
248
+ # @param resource_group_name [String] The name of the resource group to which
249
+ # the container registry belongs.
250
+ # @param registry_name [String] The name of the container registry.
251
+ # @param task_name [String] The name of the container registry task.
252
+ # @param task_create_parameters [Task] The parameters for creating a task.
253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
254
+ # will be added to the HTTP request.
255
+ #
256
+ # @return [Concurrent::Promise] promise which provides async access to http
257
+ # response.
258
+ #
259
+ def create_async(resource_group_name, registry_name, task_name, task_create_parameters, custom_headers:nil)
260
+ # Send request
261
+ promise = begin_create_async(resource_group_name, registry_name, task_name, task_create_parameters, custom_headers:custom_headers)
262
+
263
+ promise = promise.then do |response|
264
+ # Defining deserialization method.
265
+ deserialize_method = lambda do |parsed_response|
266
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Task.mapper()
267
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
268
+ end
269
+
270
+ # Waiting for response.
271
+ @client.get_long_running_operation_result(response, deserialize_method)
272
+ end
273
+
274
+ promise
275
+ end
276
+
277
+ #
278
+ # Deletes a specified task.
279
+ #
280
+ # @param resource_group_name [String] The name of the resource group to which
281
+ # the container registry belongs.
282
+ # @param registry_name [String] The name of the container registry.
283
+ # @param task_name [String] The name of the container registry task.
284
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
285
+ # will be added to the HTTP request.
286
+ #
287
+ def delete(resource_group_name, registry_name, task_name, custom_headers:nil)
288
+ response = delete_async(resource_group_name, registry_name, task_name, custom_headers:custom_headers).value!
289
+ nil
290
+ end
291
+
292
+ #
293
+ # @param resource_group_name [String] The name of the resource group to which
294
+ # the container registry belongs.
295
+ # @param registry_name [String] The name of the container registry.
296
+ # @param task_name [String] The name of the container registry task.
297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
298
+ # will be added to the HTTP request.
299
+ #
300
+ # @return [Concurrent::Promise] promise which provides async access to http
301
+ # response.
302
+ #
303
+ def delete_async(resource_group_name, registry_name, task_name, custom_headers:nil)
304
+ # Send request
305
+ promise = begin_delete_async(resource_group_name, registry_name, task_name, custom_headers:custom_headers)
306
+
307
+ promise = promise.then do |response|
308
+ # Defining deserialization method.
309
+ deserialize_method = lambda do |parsed_response|
310
+ end
311
+
312
+ # Waiting for response.
313
+ @client.get_long_running_operation_result(response, deserialize_method)
314
+ end
315
+
316
+ promise
317
+ end
318
+
319
+ #
320
+ # Updates a task with the specified parameters.
321
+ #
322
+ # @param resource_group_name [String] The name of the resource group to which
323
+ # the container registry belongs.
324
+ # @param registry_name [String] The name of the container registry.
325
+ # @param task_name [String] The name of the container registry task.
326
+ # @param task_update_parameters [TaskUpdateParameters] The parameters for
327
+ # updating a task.
328
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
329
+ # will be added to the HTTP request.
330
+ #
331
+ # @return [Task] operation results.
332
+ #
333
+ def update(resource_group_name, registry_name, task_name, task_update_parameters, custom_headers:nil)
334
+ response = update_async(resource_group_name, registry_name, task_name, task_update_parameters, custom_headers:custom_headers).value!
335
+ response.body unless response.nil?
336
+ end
337
+
338
+ #
339
+ # @param resource_group_name [String] The name of the resource group to which
340
+ # the container registry belongs.
341
+ # @param registry_name [String] The name of the container registry.
342
+ # @param task_name [String] The name of the container registry task.
343
+ # @param task_update_parameters [TaskUpdateParameters] The parameters for
344
+ # updating a task.
345
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
346
+ # will be added to the HTTP request.
347
+ #
348
+ # @return [Concurrent::Promise] promise which provides async access to http
349
+ # response.
350
+ #
351
+ def update_async(resource_group_name, registry_name, task_name, task_update_parameters, custom_headers:nil)
352
+ # Send request
353
+ promise = begin_update_async(resource_group_name, registry_name, task_name, task_update_parameters, custom_headers:custom_headers)
354
+
355
+ promise = promise.then do |response|
356
+ # Defining deserialization method.
357
+ deserialize_method = lambda do |parsed_response|
358
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Task.mapper()
359
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
360
+ end
361
+
362
+ # Waiting for response.
363
+ @client.get_long_running_operation_result(response, deserialize_method)
364
+ end
365
+
366
+ promise
367
+ end
368
+
369
+ #
370
+ # Returns a task with extended information that includes all secrets.
371
+ #
372
+ # @param resource_group_name [String] The name of the resource group to which
373
+ # the container registry belongs.
374
+ # @param registry_name [String] The name of the container registry.
375
+ # @param task_name [String] The name of the container registry task.
376
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
377
+ # will be added to the HTTP request.
378
+ #
379
+ # @return [Task] operation results.
380
+ #
381
+ def get_details(resource_group_name, registry_name, task_name, custom_headers:nil)
382
+ response = get_details_async(resource_group_name, registry_name, task_name, custom_headers:custom_headers).value!
383
+ response.body unless response.nil?
384
+ end
385
+
386
+ #
387
+ # Returns a task with extended information that includes all secrets.
388
+ #
389
+ # @param resource_group_name [String] The name of the resource group to which
390
+ # the container registry belongs.
391
+ # @param registry_name [String] The name of the container registry.
392
+ # @param task_name [String] The name of the container registry task.
393
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
394
+ # will be added to the HTTP request.
395
+ #
396
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
397
+ #
398
+ def get_details_with_http_info(resource_group_name, registry_name, task_name, custom_headers:nil)
399
+ get_details_async(resource_group_name, registry_name, task_name, custom_headers:custom_headers).value!
400
+ end
401
+
402
+ #
403
+ # Returns a task with extended information that includes all secrets.
404
+ #
405
+ # @param resource_group_name [String] The name of the resource group to which
406
+ # the container registry belongs.
407
+ # @param registry_name [String] The name of the container registry.
408
+ # @param task_name [String] The name of the container registry task.
409
+ # @param [Hash{String => String}] A hash of custom headers that will be added
410
+ # to the HTTP request.
411
+ #
412
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
413
+ #
414
+ def get_details_async(resource_group_name, registry_name, task_name, custom_headers:nil)
415
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
416
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
417
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
418
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
419
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
420
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
421
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9]*$'" if !registry_name.nil? && registry_name.match(Regexp.new('^^[a-zA-Z0-9]*$$')).nil?
422
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
423
+ fail ArgumentError, 'task_name is nil' if task_name.nil?
424
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MaxLength': '50'" if !task_name.nil? && task_name.length > 50
425
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MinLength': '5'" if !task_name.nil? && task_name.length < 5
426
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9-_]*$'" if !task_name.nil? && task_name.match(Regexp.new('^^[a-zA-Z0-9-_]*$$')).nil?
427
+
428
+
429
+ request_headers = {}
430
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
431
+
432
+ # Set Headers
433
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
434
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
435
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails'
436
+
437
+ request_url = @base_url || @client.base_url
438
+
439
+ options = {
440
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
441
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'taskName' => task_name},
442
+ query_params: {'api-version' => @client.api_version},
443
+ headers: request_headers.merge(custom_headers || {}),
444
+ base_url: request_url
445
+ }
446
+ promise = @client.make_request_async(:post, path_template, options)
447
+
448
+ promise = promise.then do |result|
449
+ http_response = result.response
450
+ status_code = http_response.status
451
+ response_content = http_response.body
452
+ unless status_code == 200
453
+ error_model = JSON.load(response_content)
454
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
455
+ end
456
+
457
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
458
+ # Deserialize Response
459
+ if status_code == 200
460
+ begin
461
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
462
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Task.mapper()
463
+ result.body = @client.deserialize(result_mapper, parsed_response)
464
+ rescue Exception => e
465
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
466
+ end
467
+ end
468
+
469
+ result
470
+ end
471
+
472
+ promise.execute
473
+ end
474
+
475
+ #
476
+ # Creates a task for a container registry with the specified parameters.
477
+ #
478
+ # @param resource_group_name [String] The name of the resource group to which
479
+ # the container registry belongs.
480
+ # @param registry_name [String] The name of the container registry.
481
+ # @param task_name [String] The name of the container registry task.
482
+ # @param task_create_parameters [Task] The parameters for creating a task.
483
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
484
+ # will be added to the HTTP request.
485
+ #
486
+ # @return [Task] operation results.
487
+ #
488
+ def begin_create(resource_group_name, registry_name, task_name, task_create_parameters, custom_headers:nil)
489
+ response = begin_create_async(resource_group_name, registry_name, task_name, task_create_parameters, custom_headers:custom_headers).value!
490
+ response.body unless response.nil?
491
+ end
492
+
493
+ #
494
+ # Creates a task for a container registry with the specified parameters.
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 task_name [String] The name of the container registry task.
500
+ # @param task_create_parameters [Task] The parameters for creating a task.
501
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
502
+ # will be added to the HTTP request.
503
+ #
504
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
505
+ #
506
+ def begin_create_with_http_info(resource_group_name, registry_name, task_name, task_create_parameters, custom_headers:nil)
507
+ begin_create_async(resource_group_name, registry_name, task_name, task_create_parameters, custom_headers:custom_headers).value!
508
+ end
509
+
510
+ #
511
+ # Creates a task for a container registry with the specified parameters.
512
+ #
513
+ # @param resource_group_name [String] The name of the resource group to which
514
+ # the container registry belongs.
515
+ # @param registry_name [String] The name of the container registry.
516
+ # @param task_name [String] The name of the container registry task.
517
+ # @param task_create_parameters [Task] The parameters for creating a task.
518
+ # @param [Hash{String => String}] A hash of custom headers that will be added
519
+ # to the HTTP request.
520
+ #
521
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
522
+ #
523
+ def begin_create_async(resource_group_name, registry_name, task_name, task_create_parameters, custom_headers:nil)
524
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
525
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
526
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
527
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
528
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
529
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
530
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9]*$'" if !registry_name.nil? && registry_name.match(Regexp.new('^^[a-zA-Z0-9]*$$')).nil?
531
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
532
+ fail ArgumentError, 'task_name is nil' if task_name.nil?
533
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MaxLength': '50'" if !task_name.nil? && task_name.length > 50
534
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MinLength': '5'" if !task_name.nil? && task_name.length < 5
535
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9-_]*$'" if !task_name.nil? && task_name.match(Regexp.new('^^[a-zA-Z0-9-_]*$$')).nil?
536
+ fail ArgumentError, 'task_create_parameters is nil' if task_create_parameters.nil?
537
+
538
+
539
+ request_headers = {}
540
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
541
+
542
+ # Set Headers
543
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
544
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
545
+
546
+ # Serialize Request
547
+ request_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Task.mapper()
548
+ request_content = @client.serialize(request_mapper, task_create_parameters)
549
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
550
+
551
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'
552
+
553
+ request_url = @base_url || @client.base_url
554
+
555
+ options = {
556
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
557
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'taskName' => task_name},
558
+ query_params: {'api-version' => @client.api_version},
559
+ body: request_content,
560
+ headers: request_headers.merge(custom_headers || {}),
561
+ base_url: request_url
562
+ }
563
+ promise = @client.make_request_async(:put, path_template, options)
564
+
565
+ promise = promise.then do |result|
566
+ http_response = result.response
567
+ status_code = http_response.status
568
+ response_content = http_response.body
569
+ unless status_code == 200 || status_code == 201
570
+ error_model = JSON.load(response_content)
571
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
572
+ end
573
+
574
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
575
+ # Deserialize Response
576
+ if status_code == 200
577
+ begin
578
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
579
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Task.mapper()
580
+ result.body = @client.deserialize(result_mapper, parsed_response)
581
+ rescue Exception => e
582
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
583
+ end
584
+ end
585
+ # Deserialize Response
586
+ if status_code == 201
587
+ begin
588
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
589
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Task.mapper()
590
+ result.body = @client.deserialize(result_mapper, parsed_response)
591
+ rescue Exception => e
592
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
593
+ end
594
+ end
595
+
596
+ result
597
+ end
598
+
599
+ promise.execute
600
+ end
601
+
602
+ #
603
+ # Deletes a specified task.
604
+ #
605
+ # @param resource_group_name [String] The name of the resource group to which
606
+ # the container registry belongs.
607
+ # @param registry_name [String] The name of the container registry.
608
+ # @param task_name [String] The name of the container registry task.
609
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
610
+ # will be added to the HTTP request.
611
+ #
612
+ #
613
+ def begin_delete(resource_group_name, registry_name, task_name, custom_headers:nil)
614
+ response = begin_delete_async(resource_group_name, registry_name, task_name, custom_headers:custom_headers).value!
615
+ nil
616
+ end
617
+
618
+ #
619
+ # Deletes a specified task.
620
+ #
621
+ # @param resource_group_name [String] The name of the resource group to which
622
+ # the container registry belongs.
623
+ # @param registry_name [String] The name of the container registry.
624
+ # @param task_name [String] The name of the container registry task.
625
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
626
+ # will be added to the HTTP request.
627
+ #
628
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
629
+ #
630
+ def begin_delete_with_http_info(resource_group_name, registry_name, task_name, custom_headers:nil)
631
+ begin_delete_async(resource_group_name, registry_name, task_name, custom_headers:custom_headers).value!
632
+ end
633
+
634
+ #
635
+ # Deletes a specified task.
636
+ #
637
+ # @param resource_group_name [String] The name of the resource group to which
638
+ # the container registry belongs.
639
+ # @param registry_name [String] The name of the container registry.
640
+ # @param task_name [String] The name of the container registry task.
641
+ # @param [Hash{String => String}] A hash of custom headers that will be added
642
+ # to the HTTP request.
643
+ #
644
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
645
+ #
646
+ def begin_delete_async(resource_group_name, registry_name, task_name, custom_headers:nil)
647
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
648
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
649
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
650
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
651
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
652
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
653
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9]*$'" if !registry_name.nil? && registry_name.match(Regexp.new('^^[a-zA-Z0-9]*$$')).nil?
654
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
655
+ fail ArgumentError, 'task_name is nil' if task_name.nil?
656
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MaxLength': '50'" if !task_name.nil? && task_name.length > 50
657
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MinLength': '5'" if !task_name.nil? && task_name.length < 5
658
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9-_]*$'" if !task_name.nil? && task_name.match(Regexp.new('^^[a-zA-Z0-9-_]*$$')).nil?
659
+
660
+
661
+ request_headers = {}
662
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
663
+
664
+ # Set Headers
665
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
666
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
667
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'
668
+
669
+ request_url = @base_url || @client.base_url
670
+
671
+ options = {
672
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
673
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'taskName' => task_name},
674
+ query_params: {'api-version' => @client.api_version},
675
+ headers: request_headers.merge(custom_headers || {}),
676
+ base_url: request_url
677
+ }
678
+ promise = @client.make_request_async(:delete, path_template, options)
679
+
680
+ promise = promise.then do |result|
681
+ http_response = result.response
682
+ status_code = http_response.status
683
+ response_content = http_response.body
684
+ unless status_code == 200 || status_code == 202 || status_code == 204
685
+ error_model = JSON.load(response_content)
686
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
687
+ end
688
+
689
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
690
+
691
+ result
692
+ end
693
+
694
+ promise.execute
695
+ end
696
+
697
+ #
698
+ # Updates a task with the specified parameters.
699
+ #
700
+ # @param resource_group_name [String] The name of the resource group to which
701
+ # the container registry belongs.
702
+ # @param registry_name [String] The name of the container registry.
703
+ # @param task_name [String] The name of the container registry task.
704
+ # @param task_update_parameters [TaskUpdateParameters] The parameters for
705
+ # updating a task.
706
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
707
+ # will be added to the HTTP request.
708
+ #
709
+ # @return [Task] operation results.
710
+ #
711
+ def begin_update(resource_group_name, registry_name, task_name, task_update_parameters, custom_headers:nil)
712
+ response = begin_update_async(resource_group_name, registry_name, task_name, task_update_parameters, custom_headers:custom_headers).value!
713
+ response.body unless response.nil?
714
+ end
715
+
716
+ #
717
+ # Updates a task with the specified parameters.
718
+ #
719
+ # @param resource_group_name [String] The name of the resource group to which
720
+ # the container registry belongs.
721
+ # @param registry_name [String] The name of the container registry.
722
+ # @param task_name [String] The name of the container registry task.
723
+ # @param task_update_parameters [TaskUpdateParameters] The parameters for
724
+ # updating a task.
725
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
726
+ # will be added to the HTTP request.
727
+ #
728
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
729
+ #
730
+ def begin_update_with_http_info(resource_group_name, registry_name, task_name, task_update_parameters, custom_headers:nil)
731
+ begin_update_async(resource_group_name, registry_name, task_name, task_update_parameters, custom_headers:custom_headers).value!
732
+ end
733
+
734
+ #
735
+ # Updates a task with the specified parameters.
736
+ #
737
+ # @param resource_group_name [String] The name of the resource group to which
738
+ # the container registry belongs.
739
+ # @param registry_name [String] The name of the container registry.
740
+ # @param task_name [String] The name of the container registry task.
741
+ # @param task_update_parameters [TaskUpdateParameters] The parameters for
742
+ # updating a task.
743
+ # @param [Hash{String => String}] A hash of custom headers that will be added
744
+ # to the HTTP request.
745
+ #
746
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
747
+ #
748
+ def begin_update_async(resource_group_name, registry_name, task_name, task_update_parameters, custom_headers:nil)
749
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
750
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
751
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
752
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
753
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
754
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
755
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9]*$'" if !registry_name.nil? && registry_name.match(Regexp.new('^^[a-zA-Z0-9]*$$')).nil?
756
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
757
+ fail ArgumentError, 'task_name is nil' if task_name.nil?
758
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MaxLength': '50'" if !task_name.nil? && task_name.length > 50
759
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'MinLength': '5'" if !task_name.nil? && task_name.length < 5
760
+ fail ArgumentError, "'task_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9-_]*$'" if !task_name.nil? && task_name.match(Regexp.new('^^[a-zA-Z0-9-_]*$$')).nil?
761
+ fail ArgumentError, 'task_update_parameters is nil' if task_update_parameters.nil?
762
+
763
+
764
+ request_headers = {}
765
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
766
+
767
+ # Set Headers
768
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
769
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
770
+
771
+ # Serialize Request
772
+ request_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::TaskUpdateParameters.mapper()
773
+ request_content = @client.serialize(request_mapper, task_update_parameters)
774
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
775
+
776
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}'
777
+
778
+ request_url = @base_url || @client.base_url
779
+
780
+ options = {
781
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
782
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'taskName' => task_name},
783
+ query_params: {'api-version' => @client.api_version},
784
+ body: request_content,
785
+ headers: request_headers.merge(custom_headers || {}),
786
+ base_url: request_url
787
+ }
788
+ promise = @client.make_request_async(:patch, path_template, options)
789
+
790
+ promise = promise.then do |result|
791
+ http_response = result.response
792
+ status_code = http_response.status
793
+ response_content = http_response.body
794
+ unless status_code == 200 || status_code == 201
795
+ error_model = JSON.load(response_content)
796
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
797
+ end
798
+
799
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
800
+ # Deserialize Response
801
+ if status_code == 200
802
+ begin
803
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
804
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Task.mapper()
805
+ result.body = @client.deserialize(result_mapper, parsed_response)
806
+ rescue Exception => e
807
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
808
+ end
809
+ end
810
+ # Deserialize Response
811
+ if status_code == 201
812
+ begin
813
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
814
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Task.mapper()
815
+ result.body = @client.deserialize(result_mapper, parsed_response)
816
+ rescue Exception => e
817
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
818
+ end
819
+ end
820
+
821
+ result
822
+ end
823
+
824
+ promise.execute
825
+ end
826
+
827
+ #
828
+ # Lists all the tasks for a specified container registry.
829
+ #
830
+ # @param next_page_link [String] The NextLink from the previous successful call
831
+ # to List operation.
832
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
833
+ # will be added to the HTTP request.
834
+ #
835
+ # @return [TaskListResult] operation results.
836
+ #
837
+ def list_next(next_page_link, custom_headers:nil)
838
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
839
+ response.body unless response.nil?
840
+ end
841
+
842
+ #
843
+ # Lists all the tasks for a specified container registry.
844
+ #
845
+ # @param next_page_link [String] The NextLink from the previous successful call
846
+ # to List operation.
847
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
848
+ # will be added to the HTTP request.
849
+ #
850
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
851
+ #
852
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
853
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
854
+ end
855
+
856
+ #
857
+ # Lists all the tasks for a specified container registry.
858
+ #
859
+ # @param next_page_link [String] The NextLink from the previous successful call
860
+ # to List operation.
861
+ # @param [Hash{String => String}] A hash of custom headers that will be added
862
+ # to the HTTP request.
863
+ #
864
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
865
+ #
866
+ def list_next_async(next_page_link, custom_headers:nil)
867
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
868
+
869
+
870
+ request_headers = {}
871
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
872
+
873
+ # Set Headers
874
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
875
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
876
+ path_template = '{nextLink}'
877
+
878
+ request_url = @base_url || @client.base_url
879
+
880
+ options = {
881
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
882
+ skip_encoding_path_params: {'nextLink' => next_page_link},
883
+ headers: request_headers.merge(custom_headers || {}),
884
+ base_url: request_url
885
+ }
886
+ promise = @client.make_request_async(:get, path_template, options)
887
+
888
+ promise = promise.then do |result|
889
+ http_response = result.response
890
+ status_code = http_response.status
891
+ response_content = http_response.body
892
+ unless status_code == 200
893
+ error_model = JSON.load(response_content)
894
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
895
+ end
896
+
897
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
898
+ # Deserialize Response
899
+ if status_code == 200
900
+ begin
901
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
902
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::TaskListResult.mapper()
903
+ result.body = @client.deserialize(result_mapper, parsed_response)
904
+ rescue Exception => e
905
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
906
+ end
907
+ end
908
+
909
+ result
910
+ end
911
+
912
+ promise.execute
913
+ end
914
+
915
+ #
916
+ # Lists all the tasks for a specified container registry.
917
+ #
918
+ # @param resource_group_name [String] The name of the resource group to which
919
+ # the container registry belongs.
920
+ # @param registry_name [String] The name of the container registry.
921
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
922
+ # will be added to the HTTP request.
923
+ #
924
+ # @return [TaskListResult] which provide lazy access to pages of the response.
925
+ #
926
+ def list_as_lazy(resource_group_name, registry_name, custom_headers:nil)
927
+ response = list_async(resource_group_name, registry_name, custom_headers:custom_headers).value!
928
+ unless response.nil?
929
+ page = response.body
930
+ page.next_method = Proc.new do |next_page_link|
931
+ list_next_async(next_page_link, custom_headers:custom_headers)
932
+ end
933
+ page
934
+ end
935
+ end
936
+
937
+ end
938
+ end