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,289 @@
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
+ # Registries
9
+ #
10
+ class Registries
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Registries 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
+ # Schedules a new run based on the request parameters and add it to the run
26
+ # queue.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group to which
29
+ # the container registry belongs.
30
+ # @param registry_name [String] The name of the container registry.
31
+ # @param run_request [RunRequest] The parameters of a run that needs to
32
+ # scheduled.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [Run] operation results.
37
+ #
38
+ def schedule_run(resource_group_name, registry_name, run_request, custom_headers:nil)
39
+ response = schedule_run_async(resource_group_name, registry_name, run_request, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
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 run_request [RunRequest] The parameters of a run that needs to
48
+ # scheduled.
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [Concurrent::Promise] promise which provides async access to http
53
+ # response.
54
+ #
55
+ def schedule_run_async(resource_group_name, registry_name, run_request, custom_headers:nil)
56
+ # Send request
57
+ promise = begin_schedule_run_async(resource_group_name, registry_name, run_request, custom_headers:custom_headers)
58
+
59
+ promise = promise.then do |response|
60
+ # Defining deserialization method.
61
+ deserialize_method = lambda do |parsed_response|
62
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Run.mapper()
63
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
64
+ end
65
+
66
+ # Waiting for response.
67
+ @client.get_long_running_operation_result(response, deserialize_method)
68
+ end
69
+
70
+ promise
71
+ end
72
+
73
+ #
74
+ # Get the upload location for the user to be able to upload the source.
75
+ #
76
+ # @param resource_group_name [String] The name of the resource group to which
77
+ # the container registry belongs.
78
+ # @param registry_name [String] The name of the container registry.
79
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
80
+ # will be added to the HTTP request.
81
+ #
82
+ # @return [SourceUploadDefinition] operation results.
83
+ #
84
+ def get_build_source_upload_url(resource_group_name, registry_name, custom_headers:nil)
85
+ response = get_build_source_upload_url_async(resource_group_name, registry_name, custom_headers:custom_headers).value!
86
+ response.body unless response.nil?
87
+ end
88
+
89
+ #
90
+ # Get the upload location for the user to be able to upload the source.
91
+ #
92
+ # @param resource_group_name [String] The name of the resource group to which
93
+ # the container registry belongs.
94
+ # @param registry_name [String] The name of the container registry.
95
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
96
+ # will be added to the HTTP request.
97
+ #
98
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
99
+ #
100
+ def get_build_source_upload_url_with_http_info(resource_group_name, registry_name, custom_headers:nil)
101
+ get_build_source_upload_url_async(resource_group_name, registry_name, custom_headers:custom_headers).value!
102
+ end
103
+
104
+ #
105
+ # Get the upload location for the user to be able to upload the source.
106
+ #
107
+ # @param resource_group_name [String] The name of the resource group to which
108
+ # the container registry belongs.
109
+ # @param registry_name [String] The name of the container registry.
110
+ # @param [Hash{String => String}] A hash of custom headers that will be added
111
+ # to the HTTP request.
112
+ #
113
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
114
+ #
115
+ def get_build_source_upload_url_async(resource_group_name, registry_name, custom_headers:nil)
116
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
117
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
118
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
119
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
120
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
121
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
122
+ 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?
123
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
124
+
125
+
126
+ request_headers = {}
127
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
128
+
129
+ # Set Headers
130
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
131
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
132
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl'
133
+
134
+ request_url = @base_url || @client.base_url
135
+
136
+ options = {
137
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
138
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
139
+ query_params: {'api-version' => @client.api_version},
140
+ headers: request_headers.merge(custom_headers || {}),
141
+ base_url: request_url
142
+ }
143
+ promise = @client.make_request_async(:post, path_template, options)
144
+
145
+ promise = promise.then do |result|
146
+ http_response = result.response
147
+ status_code = http_response.status
148
+ response_content = http_response.body
149
+ unless status_code == 200
150
+ error_model = JSON.load(response_content)
151
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
152
+ end
153
+
154
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
155
+ # Deserialize Response
156
+ if status_code == 200
157
+ begin
158
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
159
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::SourceUploadDefinition.mapper()
160
+ result.body = @client.deserialize(result_mapper, parsed_response)
161
+ rescue Exception => e
162
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
163
+ end
164
+ end
165
+
166
+ result
167
+ end
168
+
169
+ promise.execute
170
+ end
171
+
172
+ #
173
+ # Schedules a new run based on the request parameters and add it to the run
174
+ # queue.
175
+ #
176
+ # @param resource_group_name [String] The name of the resource group to which
177
+ # the container registry belongs.
178
+ # @param registry_name [String] The name of the container registry.
179
+ # @param run_request [RunRequest] The parameters of a run that needs to
180
+ # scheduled.
181
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
182
+ # will be added to the HTTP request.
183
+ #
184
+ # @return [Run] operation results.
185
+ #
186
+ def begin_schedule_run(resource_group_name, registry_name, run_request, custom_headers:nil)
187
+ response = begin_schedule_run_async(resource_group_name, registry_name, run_request, custom_headers:custom_headers).value!
188
+ response.body unless response.nil?
189
+ end
190
+
191
+ #
192
+ # Schedules a new run based on the request parameters and add it to the run
193
+ # queue.
194
+ #
195
+ # @param resource_group_name [String] The name of the resource group to which
196
+ # the container registry belongs.
197
+ # @param registry_name [String] The name of the container registry.
198
+ # @param run_request [RunRequest] The parameters of a run that needs to
199
+ # scheduled.
200
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
201
+ # will be added to the HTTP request.
202
+ #
203
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
204
+ #
205
+ def begin_schedule_run_with_http_info(resource_group_name, registry_name, run_request, custom_headers:nil)
206
+ begin_schedule_run_async(resource_group_name, registry_name, run_request, custom_headers:custom_headers).value!
207
+ end
208
+
209
+ #
210
+ # Schedules a new run based on the request parameters and add it to the run
211
+ # queue.
212
+ #
213
+ # @param resource_group_name [String] The name of the resource group to which
214
+ # the container registry belongs.
215
+ # @param registry_name [String] The name of the container registry.
216
+ # @param run_request [RunRequest] The parameters of a run that needs to
217
+ # scheduled.
218
+ # @param [Hash{String => String}] A hash of custom headers that will be added
219
+ # to the HTTP request.
220
+ #
221
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
222
+ #
223
+ def begin_schedule_run_async(resource_group_name, registry_name, run_request, custom_headers:nil)
224
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
225
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
226
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
227
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
228
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
229
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
230
+ 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?
231
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
232
+ fail ArgumentError, 'run_request is nil' if run_request.nil?
233
+
234
+
235
+ request_headers = {}
236
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
237
+
238
+ # Set Headers
239
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
240
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
241
+
242
+ # Serialize Request
243
+ request_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::RunRequest.mapper()
244
+ request_content = @client.serialize(request_mapper, run_request)
245
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
246
+
247
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun'
248
+
249
+ request_url = @base_url || @client.base_url
250
+
251
+ options = {
252
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
253
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
254
+ query_params: {'api-version' => @client.api_version},
255
+ body: request_content,
256
+ headers: request_headers.merge(custom_headers || {}),
257
+ base_url: request_url
258
+ }
259
+ promise = @client.make_request_async(:post, path_template, options)
260
+
261
+ promise = promise.then do |result|
262
+ http_response = result.response
263
+ status_code = http_response.status
264
+ response_content = http_response.body
265
+ unless status_code == 200 || status_code == 202
266
+ error_model = JSON.load(response_content)
267
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
268
+ end
269
+
270
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
271
+ # Deserialize Response
272
+ if status_code == 200
273
+ begin
274
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
275
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Run.mapper()
276
+ result.body = @client.deserialize(result_mapper, parsed_response)
277
+ rescue Exception => e
278
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
279
+ end
280
+ end
281
+
282
+ result
283
+ end
284
+
285
+ promise.execute
286
+ end
287
+
288
+ end
289
+ end
@@ -0,0 +1,766 @@
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
+ # Runs
9
+ #
10
+ class Runs
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Runs 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 all the runs for a 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 filter [String] The runs filter to apply on the operation. Arithmetic
31
+ # operators are not supported. The allowed string function is 'contains'. All
32
+ # logical operators except 'Not', 'Has', 'All' are allowed.
33
+ # @param top [Integer] $top is supported for get list of runs, which limits the
34
+ # maximum number of runs to return.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [Array<Run>] operation results.
39
+ #
40
+ def list(resource_group_name, registry_name, filter:nil, top:nil, custom_headers:nil)
41
+ first_page = list_as_lazy(resource_group_name, registry_name, filter:filter, top:top, custom_headers:custom_headers)
42
+ first_page.get_all_items
43
+ end
44
+
45
+ #
46
+ # Gets all the runs for a registry.
47
+ #
48
+ # @param resource_group_name [String] The name of the resource group to which
49
+ # the container registry belongs.
50
+ # @param registry_name [String] The name of the container registry.
51
+ # @param filter [String] The runs filter to apply on the operation. Arithmetic
52
+ # operators are not supported. The allowed string function is 'contains'. All
53
+ # logical operators except 'Not', 'Has', 'All' are allowed.
54
+ # @param top [Integer] $top is supported for get list of runs, which limits the
55
+ # maximum number of runs to return.
56
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
57
+ # will be added to the HTTP request.
58
+ #
59
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
60
+ #
61
+ def list_with_http_info(resource_group_name, registry_name, filter:nil, top:nil, custom_headers:nil)
62
+ list_async(resource_group_name, registry_name, filter:filter, top:top, custom_headers:custom_headers).value!
63
+ end
64
+
65
+ #
66
+ # Gets all the runs for a registry.
67
+ #
68
+ # @param resource_group_name [String] The name of the resource group to which
69
+ # the container registry belongs.
70
+ # @param registry_name [String] The name of the container registry.
71
+ # @param filter [String] The runs filter to apply on the operation. Arithmetic
72
+ # operators are not supported. The allowed string function is 'contains'. All
73
+ # logical operators except 'Not', 'Has', 'All' are allowed.
74
+ # @param top [Integer] $top is supported for get list of runs, which limits the
75
+ # maximum number of runs to return.
76
+ # @param [Hash{String => String}] A hash of custom headers that will be added
77
+ # to the HTTP request.
78
+ #
79
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
80
+ #
81
+ def list_async(resource_group_name, registry_name, filter:nil, top:nil, custom_headers:nil)
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
84
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
85
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
86
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
87
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
88
+ 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?
89
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
90
+
91
+
92
+ request_headers = {}
93
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
94
+
95
+ # Set Headers
96
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
97
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
98
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs'
99
+
100
+ request_url = @base_url || @client.base_url
101
+
102
+ options = {
103
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
104
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name},
105
+ query_params: {'api-version' => @client.api_version,'$filter' => filter,'$top' => top},
106
+ headers: request_headers.merge(custom_headers || {}),
107
+ base_url: request_url
108
+ }
109
+ promise = @client.make_request_async(:get, path_template, options)
110
+
111
+ promise = promise.then do |result|
112
+ http_response = result.response
113
+ status_code = http_response.status
114
+ response_content = http_response.body
115
+ unless status_code == 200
116
+ error_model = JSON.load(response_content)
117
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
118
+ end
119
+
120
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
121
+ # Deserialize Response
122
+ if status_code == 200
123
+ begin
124
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
125
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::RunListResult.mapper()
126
+ result.body = @client.deserialize(result_mapper, parsed_response)
127
+ rescue Exception => e
128
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
129
+ end
130
+ end
131
+
132
+ result
133
+ end
134
+
135
+ promise.execute
136
+ end
137
+
138
+ #
139
+ # Gets the detailed information for a given run.
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 run_id [String] The run ID.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [Run] operation results.
149
+ #
150
+ def get(resource_group_name, registry_name, run_id, custom_headers:nil)
151
+ response = get_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
152
+ response.body unless response.nil?
153
+ end
154
+
155
+ #
156
+ # Gets the detailed information for a given run.
157
+ #
158
+ # @param resource_group_name [String] The name of the resource group to which
159
+ # the container registry belongs.
160
+ # @param registry_name [String] The name of the container registry.
161
+ # @param run_id [String] The run ID.
162
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
163
+ # will be added to the HTTP request.
164
+ #
165
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
166
+ #
167
+ def get_with_http_info(resource_group_name, registry_name, run_id, custom_headers:nil)
168
+ get_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
169
+ end
170
+
171
+ #
172
+ # Gets the detailed information for a given run.
173
+ #
174
+ # @param resource_group_name [String] The name of the resource group to which
175
+ # the container registry belongs.
176
+ # @param registry_name [String] The name of the container registry.
177
+ # @param run_id [String] The run ID.
178
+ # @param [Hash{String => String}] A hash of custom headers that will be added
179
+ # to the HTTP request.
180
+ #
181
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
182
+ #
183
+ def get_async(resource_group_name, registry_name, run_id, custom_headers:nil)
184
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
185
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
186
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
187
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
188
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
189
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
190
+ 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?
191
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
192
+ fail ArgumentError, 'run_id is nil' if run_id.nil?
193
+
194
+
195
+ request_headers = {}
196
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
197
+
198
+ # Set Headers
199
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
200
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
201
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'
202
+
203
+ request_url = @base_url || @client.base_url
204
+
205
+ options = {
206
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
207
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'runId' => run_id},
208
+ query_params: {'api-version' => @client.api_version},
209
+ headers: request_headers.merge(custom_headers || {}),
210
+ base_url: request_url
211
+ }
212
+ promise = @client.make_request_async(:get, path_template, options)
213
+
214
+ promise = promise.then do |result|
215
+ http_response = result.response
216
+ status_code = http_response.status
217
+ response_content = http_response.body
218
+ unless status_code == 200
219
+ error_model = JSON.load(response_content)
220
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
221
+ end
222
+
223
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
224
+ # Deserialize Response
225
+ if status_code == 200
226
+ begin
227
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
228
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Run.mapper()
229
+ result.body = @client.deserialize(result_mapper, parsed_response)
230
+ rescue Exception => e
231
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
232
+ end
233
+ end
234
+
235
+ result
236
+ end
237
+
238
+ promise.execute
239
+ end
240
+
241
+ #
242
+ # Patch the run properties.
243
+ #
244
+ # @param resource_group_name [String] The name of the resource group to which
245
+ # the container registry belongs.
246
+ # @param registry_name [String] The name of the container registry.
247
+ # @param run_id [String] The run ID.
248
+ # @param run_update_parameters [RunUpdateParameters] The run update properties.
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ # @return [Run] operation results.
253
+ #
254
+ def update(resource_group_name, registry_name, run_id, run_update_parameters, custom_headers:nil)
255
+ response = update_async(resource_group_name, registry_name, run_id, run_update_parameters, custom_headers:custom_headers).value!
256
+ response.body unless response.nil?
257
+ end
258
+
259
+ #
260
+ # @param resource_group_name [String] The name of the resource group to which
261
+ # the container registry belongs.
262
+ # @param registry_name [String] The name of the container registry.
263
+ # @param run_id [String] The run ID.
264
+ # @param run_update_parameters [RunUpdateParameters] The run update properties.
265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
266
+ # will be added to the HTTP request.
267
+ #
268
+ # @return [Concurrent::Promise] promise which provides async access to http
269
+ # response.
270
+ #
271
+ def update_async(resource_group_name, registry_name, run_id, run_update_parameters, custom_headers:nil)
272
+ # Send request
273
+ promise = begin_update_async(resource_group_name, registry_name, run_id, run_update_parameters, custom_headers:custom_headers)
274
+
275
+ promise = promise.then do |response|
276
+ # Defining deserialization method.
277
+ deserialize_method = lambda do |parsed_response|
278
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Run.mapper()
279
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
280
+ end
281
+
282
+ # Waiting for response.
283
+ @client.get_long_running_operation_result(response, deserialize_method)
284
+ end
285
+
286
+ promise
287
+ end
288
+
289
+ #
290
+ # Gets a link to download the run logs.
291
+ #
292
+ # @param resource_group_name [String] The name of the resource group to which
293
+ # the container registry belongs.
294
+ # @param registry_name [String] The name of the container registry.
295
+ # @param run_id [String] The run ID.
296
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
297
+ # will be added to the HTTP request.
298
+ #
299
+ # @return [RunGetLogResult] operation results.
300
+ #
301
+ def get_log_sas_url(resource_group_name, registry_name, run_id, custom_headers:nil)
302
+ response = get_log_sas_url_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
303
+ response.body unless response.nil?
304
+ end
305
+
306
+ #
307
+ # Gets a link to download the run logs.
308
+ #
309
+ # @param resource_group_name [String] The name of the resource group to which
310
+ # the container registry belongs.
311
+ # @param registry_name [String] The name of the container registry.
312
+ # @param run_id [String] The run ID.
313
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
314
+ # will be added to the HTTP request.
315
+ #
316
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
317
+ #
318
+ def get_log_sas_url_with_http_info(resource_group_name, registry_name, run_id, custom_headers:nil)
319
+ get_log_sas_url_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
320
+ end
321
+
322
+ #
323
+ # Gets a link to download the run logs.
324
+ #
325
+ # @param resource_group_name [String] The name of the resource group to which
326
+ # the container registry belongs.
327
+ # @param registry_name [String] The name of the container registry.
328
+ # @param run_id [String] The run ID.
329
+ # @param [Hash{String => String}] A hash of custom headers that will be added
330
+ # to the HTTP request.
331
+ #
332
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
333
+ #
334
+ def get_log_sas_url_async(resource_group_name, registry_name, run_id, custom_headers:nil)
335
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
336
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
337
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
338
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
339
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
340
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
341
+ 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?
342
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
343
+ fail ArgumentError, 'run_id is nil' if run_id.nil?
344
+
345
+
346
+ request_headers = {}
347
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
348
+
349
+ # Set Headers
350
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
351
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
352
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl'
353
+
354
+ request_url = @base_url || @client.base_url
355
+
356
+ options = {
357
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
358
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'runId' => run_id},
359
+ query_params: {'api-version' => @client.api_version},
360
+ headers: request_headers.merge(custom_headers || {}),
361
+ base_url: request_url
362
+ }
363
+ promise = @client.make_request_async(:post, path_template, options)
364
+
365
+ promise = promise.then do |result|
366
+ http_response = result.response
367
+ status_code = http_response.status
368
+ response_content = http_response.body
369
+ unless status_code == 200
370
+ error_model = JSON.load(response_content)
371
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
372
+ end
373
+
374
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
375
+ # Deserialize Response
376
+ if status_code == 200
377
+ begin
378
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
379
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::RunGetLogResult.mapper()
380
+ result.body = @client.deserialize(result_mapper, parsed_response)
381
+ rescue Exception => e
382
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
383
+ end
384
+ end
385
+
386
+ result
387
+ end
388
+
389
+ promise.execute
390
+ end
391
+
392
+ #
393
+ # Cancel an existing run.
394
+ #
395
+ # @param resource_group_name [String] The name of the resource group to which
396
+ # the container registry belongs.
397
+ # @param registry_name [String] The name of the container registry.
398
+ # @param run_id [String] The run ID.
399
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
400
+ # will be added to the HTTP request.
401
+ #
402
+ def cancel(resource_group_name, registry_name, run_id, custom_headers:nil)
403
+ response = cancel_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
404
+ nil
405
+ end
406
+
407
+ #
408
+ # @param resource_group_name [String] The name of the resource group to which
409
+ # the container registry belongs.
410
+ # @param registry_name [String] The name of the container registry.
411
+ # @param run_id [String] The run ID.
412
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
413
+ # will be added to the HTTP request.
414
+ #
415
+ # @return [Concurrent::Promise] promise which provides async access to http
416
+ # response.
417
+ #
418
+ def cancel_async(resource_group_name, registry_name, run_id, custom_headers:nil)
419
+ # Send request
420
+ promise = begin_cancel_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers)
421
+
422
+ promise = promise.then do |response|
423
+ # Defining deserialization method.
424
+ deserialize_method = lambda do |parsed_response|
425
+ end
426
+
427
+ # Waiting for response.
428
+ @client.get_long_running_operation_result(response, deserialize_method)
429
+ end
430
+
431
+ promise
432
+ end
433
+
434
+ #
435
+ # Patch the run properties.
436
+ #
437
+ # @param resource_group_name [String] The name of the resource group to which
438
+ # the container registry belongs.
439
+ # @param registry_name [String] The name of the container registry.
440
+ # @param run_id [String] The run ID.
441
+ # @param run_update_parameters [RunUpdateParameters] The run update properties.
442
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
443
+ # will be added to the HTTP request.
444
+ #
445
+ # @return [Run] operation results.
446
+ #
447
+ def begin_update(resource_group_name, registry_name, run_id, run_update_parameters, custom_headers:nil)
448
+ response = begin_update_async(resource_group_name, registry_name, run_id, run_update_parameters, custom_headers:custom_headers).value!
449
+ response.body unless response.nil?
450
+ end
451
+
452
+ #
453
+ # Patch the run properties.
454
+ #
455
+ # @param resource_group_name [String] The name of the resource group to which
456
+ # the container registry belongs.
457
+ # @param registry_name [String] The name of the container registry.
458
+ # @param run_id [String] The run ID.
459
+ # @param run_update_parameters [RunUpdateParameters] The run update properties.
460
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
461
+ # will be added to the HTTP request.
462
+ #
463
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
464
+ #
465
+ def begin_update_with_http_info(resource_group_name, registry_name, run_id, run_update_parameters, custom_headers:nil)
466
+ begin_update_async(resource_group_name, registry_name, run_id, run_update_parameters, custom_headers:custom_headers).value!
467
+ end
468
+
469
+ #
470
+ # Patch the run properties.
471
+ #
472
+ # @param resource_group_name [String] The name of the resource group to which
473
+ # the container registry belongs.
474
+ # @param registry_name [String] The name of the container registry.
475
+ # @param run_id [String] The run ID.
476
+ # @param run_update_parameters [RunUpdateParameters] The run update properties.
477
+ # @param [Hash{String => String}] A hash of custom headers that will be added
478
+ # to the HTTP request.
479
+ #
480
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
481
+ #
482
+ def begin_update_async(resource_group_name, registry_name, run_id, run_update_parameters, custom_headers:nil)
483
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
484
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
485
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
486
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
487
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
488
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
489
+ 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?
490
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
491
+ fail ArgumentError, 'run_id is nil' if run_id.nil?
492
+ fail ArgumentError, 'run_update_parameters is nil' if run_update_parameters.nil?
493
+
494
+
495
+ request_headers = {}
496
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
497
+
498
+ # Set Headers
499
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
500
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
501
+
502
+ # Serialize Request
503
+ request_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::RunUpdateParameters.mapper()
504
+ request_content = @client.serialize(request_mapper, run_update_parameters)
505
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
506
+
507
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}'
508
+
509
+ request_url = @base_url || @client.base_url
510
+
511
+ options = {
512
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
513
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'runId' => run_id},
514
+ query_params: {'api-version' => @client.api_version},
515
+ body: request_content,
516
+ headers: request_headers.merge(custom_headers || {}),
517
+ base_url: request_url
518
+ }
519
+ promise = @client.make_request_async(:patch, path_template, options)
520
+
521
+ promise = promise.then do |result|
522
+ http_response = result.response
523
+ status_code = http_response.status
524
+ response_content = http_response.body
525
+ unless status_code == 200 || status_code == 201
526
+ error_model = JSON.load(response_content)
527
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
528
+ end
529
+
530
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
531
+ # Deserialize Response
532
+ if status_code == 200
533
+ begin
534
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
535
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Run.mapper()
536
+ result.body = @client.deserialize(result_mapper, parsed_response)
537
+ rescue Exception => e
538
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
539
+ end
540
+ end
541
+ # Deserialize Response
542
+ if status_code == 201
543
+ begin
544
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
545
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::Run.mapper()
546
+ result.body = @client.deserialize(result_mapper, parsed_response)
547
+ rescue Exception => e
548
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
549
+ end
550
+ end
551
+
552
+ result
553
+ end
554
+
555
+ promise.execute
556
+ end
557
+
558
+ #
559
+ # Cancel an existing run.
560
+ #
561
+ # @param resource_group_name [String] The name of the resource group to which
562
+ # the container registry belongs.
563
+ # @param registry_name [String] The name of the container registry.
564
+ # @param run_id [String] The run ID.
565
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
566
+ # will be added to the HTTP request.
567
+ #
568
+ #
569
+ def begin_cancel(resource_group_name, registry_name, run_id, custom_headers:nil)
570
+ response = begin_cancel_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
571
+ nil
572
+ end
573
+
574
+ #
575
+ # Cancel an existing run.
576
+ #
577
+ # @param resource_group_name [String] The name of the resource group to which
578
+ # the container registry belongs.
579
+ # @param registry_name [String] The name of the container registry.
580
+ # @param run_id [String] The run ID.
581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
582
+ # will be added to the HTTP request.
583
+ #
584
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
585
+ #
586
+ def begin_cancel_with_http_info(resource_group_name, registry_name, run_id, custom_headers:nil)
587
+ begin_cancel_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
588
+ end
589
+
590
+ #
591
+ # Cancel an existing run.
592
+ #
593
+ # @param resource_group_name [String] The name of the resource group to which
594
+ # the container registry belongs.
595
+ # @param registry_name [String] The name of the container registry.
596
+ # @param run_id [String] The run ID.
597
+ # @param [Hash{String => String}] A hash of custom headers that will be added
598
+ # to the HTTP request.
599
+ #
600
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
601
+ #
602
+ def begin_cancel_async(resource_group_name, registry_name, run_id, custom_headers:nil)
603
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
604
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
605
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
606
+ fail ArgumentError, 'registry_name is nil' if registry_name.nil?
607
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MaxLength': '50'" if !registry_name.nil? && registry_name.length > 50
608
+ fail ArgumentError, "'registry_name' should satisfy the constraint - 'MinLength': '5'" if !registry_name.nil? && registry_name.length < 5
609
+ 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?
610
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
611
+ fail ArgumentError, 'run_id is nil' if run_id.nil?
612
+
613
+
614
+ request_headers = {}
615
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
616
+
617
+ # Set Headers
618
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
619
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
620
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel'
621
+
622
+ request_url = @base_url || @client.base_url
623
+
624
+ options = {
625
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
626
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'registryName' => registry_name,'runId' => run_id},
627
+ query_params: {'api-version' => @client.api_version},
628
+ headers: request_headers.merge(custom_headers || {}),
629
+ base_url: request_url
630
+ }
631
+ promise = @client.make_request_async(:post, path_template, options)
632
+
633
+ promise = promise.then do |result|
634
+ http_response = result.response
635
+ status_code = http_response.status
636
+ response_content = http_response.body
637
+ unless status_code == 200 || status_code == 202
638
+ error_model = JSON.load(response_content)
639
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
640
+ end
641
+
642
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
643
+
644
+ result
645
+ end
646
+
647
+ promise.execute
648
+ end
649
+
650
+ #
651
+ # Gets all the runs for a registry.
652
+ #
653
+ # @param next_page_link [String] The NextLink from the previous successful call
654
+ # to List operation.
655
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
656
+ # will be added to the HTTP request.
657
+ #
658
+ # @return [RunListResult] operation results.
659
+ #
660
+ def list_next(next_page_link, custom_headers:nil)
661
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
662
+ response.body unless response.nil?
663
+ end
664
+
665
+ #
666
+ # Gets all the runs for a registry.
667
+ #
668
+ # @param next_page_link [String] The NextLink from the previous successful call
669
+ # to List operation.
670
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
671
+ # will be added to the HTTP request.
672
+ #
673
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
674
+ #
675
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
676
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
677
+ end
678
+
679
+ #
680
+ # Gets all the runs for a registry.
681
+ #
682
+ # @param next_page_link [String] The NextLink from the previous successful call
683
+ # to List operation.
684
+ # @param [Hash{String => String}] A hash of custom headers that will be added
685
+ # to the HTTP request.
686
+ #
687
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
688
+ #
689
+ def list_next_async(next_page_link, custom_headers:nil)
690
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
691
+
692
+
693
+ request_headers = {}
694
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
695
+
696
+ # Set Headers
697
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
698
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
699
+ path_template = '{nextLink}'
700
+
701
+ request_url = @base_url || @client.base_url
702
+
703
+ options = {
704
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
705
+ skip_encoding_path_params: {'nextLink' => next_page_link},
706
+ headers: request_headers.merge(custom_headers || {}),
707
+ base_url: request_url
708
+ }
709
+ promise = @client.make_request_async(:get, path_template, options)
710
+
711
+ promise = promise.then do |result|
712
+ http_response = result.response
713
+ status_code = http_response.status
714
+ response_content = http_response.body
715
+ unless status_code == 200
716
+ error_model = JSON.load(response_content)
717
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
718
+ end
719
+
720
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
721
+ # Deserialize Response
722
+ if status_code == 200
723
+ begin
724
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
725
+ result_mapper = Azure::ContainerRegistry::Mgmt::V2019_04_01::Models::RunListResult.mapper()
726
+ result.body = @client.deserialize(result_mapper, parsed_response)
727
+ rescue Exception => e
728
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
729
+ end
730
+ end
731
+
732
+ result
733
+ end
734
+
735
+ promise.execute
736
+ end
737
+
738
+ #
739
+ # Gets all the runs for a registry.
740
+ #
741
+ # @param resource_group_name [String] The name of the resource group to which
742
+ # the container registry belongs.
743
+ # @param registry_name [String] The name of the container registry.
744
+ # @param filter [String] The runs filter to apply on the operation. Arithmetic
745
+ # operators are not supported. The allowed string function is 'contains'. All
746
+ # logical operators except 'Not', 'Has', 'All' are allowed.
747
+ # @param top [Integer] $top is supported for get list of runs, which limits the
748
+ # maximum number of runs to return.
749
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
750
+ # will be added to the HTTP request.
751
+ #
752
+ # @return [RunListResult] which provide lazy access to pages of the response.
753
+ #
754
+ def list_as_lazy(resource_group_name, registry_name, filter:nil, top:nil, custom_headers:nil)
755
+ response = list_async(resource_group_name, registry_name, filter:filter, top:top, custom_headers:custom_headers).value!
756
+ unless response.nil?
757
+ page = response.body
758
+ page.next_method = Proc.new do |next_page_link|
759
+ list_next_async(next_page_link, custom_headers:custom_headers)
760
+ end
761
+ page
762
+ end
763
+ end
764
+
765
+ end
766
+ end