be_azure_cognitiveservices_face 0.19.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/1.0/generated/azure_cognitiveservices_face/face.rb +1711 -0
  4. data/lib/1.0/generated/azure_cognitiveservices_face/face_client.rb +159 -0
  5. data/lib/1.0/generated/azure_cognitiveservices_face/face_list_operations.rb +1269 -0
  6. data/lib/1.0/generated/azure_cognitiveservices_face/large_face_list_operations.rb +1894 -0
  7. data/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb +886 -0
  8. data/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb +1477 -0
  9. data/lib/1.0/generated/azure_cognitiveservices_face/models/accessory.rb +59 -0
  10. data/lib/1.0/generated/azure_cognitiveservices_face/models/accessory_type.rb +17 -0
  11. data/lib/1.0/generated/azure_cognitiveservices_face/models/apierror.rb +47 -0
  12. data/lib/1.0/generated/azure_cognitiveservices_face/models/apply_snapshot_request.rb +69 -0
  13. data/lib/1.0/generated/azure_cognitiveservices_face/models/blur.rb +60 -0
  14. data/lib/1.0/generated/azure_cognitiveservices_face/models/blur_level.rb +17 -0
  15. data/lib/1.0/generated/azure_cognitiveservices_face/models/coordinate.rb +57 -0
  16. data/lib/1.0/generated/azure_cognitiveservices_face/models/detected_face.rb +95 -0
  17. data/lib/1.0/generated/azure_cognitiveservices_face/models/detection_model.rb +16 -0
  18. data/lib/1.0/generated/azure_cognitiveservices_face/models/emotion.rb +124 -0
  19. data/lib/1.0/generated/azure_cognitiveservices_face/models/error.rb +57 -0
  20. data/lib/1.0/generated/azure_cognitiveservices_face/models/exposure.rb +62 -0
  21. data/lib/1.0/generated/azure_cognitiveservices_face/models/exposure_level.rb +17 -0
  22. data/lib/1.0/generated/azure_cognitiveservices_face/models/face_attribute_type.rb +28 -0
  23. data/lib/1.0/generated/azure_cognitiveservices_face/models/face_attributes.rb +214 -0
  24. data/lib/1.0/generated/azure_cognitiveservices_face/models/face_landmarks.rb +360 -0
  25. data/lib/1.0/generated/azure_cognitiveservices_face/models/face_list.rb +101 -0
  26. data/lib/1.0/generated/azure_cognitiveservices_face/models/face_rectangle.rb +81 -0
  27. data/lib/1.0/generated/azure_cognitiveservices_face/models/facial_hair.rb +68 -0
  28. data/lib/1.0/generated/azure_cognitiveservices_face/models/find_similar_match_mode.rb +16 -0
  29. data/lib/1.0/generated/azure_cognitiveservices_face/models/find_similar_request.rb +143 -0
  30. data/lib/1.0/generated/azure_cognitiveservices_face/models/gender.rb +16 -0
  31. data/lib/1.0/generated/azure_cognitiveservices_face/models/glasses_type.rb +18 -0
  32. data/lib/1.0/generated/azure_cognitiveservices_face/models/group_request.rb +58 -0
  33. data/lib/1.0/generated/azure_cognitiveservices_face/models/group_result.rb +83 -0
  34. data/lib/1.0/generated/azure_cognitiveservices_face/models/hair.rb +80 -0
  35. data/lib/1.0/generated/azure_cognitiveservices_face/models/hair_color.rb +60 -0
  36. data/lib/1.0/generated/azure_cognitiveservices_face/models/hair_color_type.rb +22 -0
  37. data/lib/1.0/generated/azure_cognitiveservices_face/models/head_pose.rb +68 -0
  38. data/lib/1.0/generated/azure_cognitiveservices_face/models/identify_candidate.rb +59 -0
  39. data/lib/1.0/generated/azure_cognitiveservices_face/models/identify_request.rb +123 -0
  40. data/lib/1.0/generated/azure_cognitiveservices_face/models/identify_result.rb +69 -0
  41. data/lib/1.0/generated/azure_cognitiveservices_face/models/image_url.rb +47 -0
  42. data/lib/1.0/generated/azure_cognitiveservices_face/models/large_face_list.rb +81 -0
  43. data/lib/1.0/generated/azure_cognitiveservices_face/models/large_person_group.rb +81 -0
  44. data/lib/1.0/generated/azure_cognitiveservices_face/models/makeup.rb +59 -0
  45. data/lib/1.0/generated/azure_cognitiveservices_face/models/meta_data_contract.rb +72 -0
  46. data/lib/1.0/generated/azure_cognitiveservices_face/models/name_and_user_data_contract.rb +64 -0
  47. data/lib/1.0/generated/azure_cognitiveservices_face/models/noise.rb +62 -0
  48. data/lib/1.0/generated/azure_cognitiveservices_face/models/noise_level.rb +17 -0
  49. data/lib/1.0/generated/azure_cognitiveservices_face/models/occlusion.rb +70 -0
  50. data/lib/1.0/generated/azure_cognitiveservices_face/models/operation_status.rb +112 -0
  51. data/lib/1.0/generated/azure_cognitiveservices_face/models/operation_status_type.rb +18 -0
  52. data/lib/1.0/generated/azure_cognitiveservices_face/models/persisted_face.rb +63 -0
  53. data/lib/1.0/generated/azure_cognitiveservices_face/models/person.rb +89 -0
  54. data/lib/1.0/generated/azure_cognitiveservices_face/models/person_group.rb +81 -0
  55. data/lib/1.0/generated/azure_cognitiveservices_face/models/recognition_model.rb +16 -0
  56. data/lib/1.0/generated/azure_cognitiveservices_face/models/similar_face.rb +73 -0
  57. data/lib/1.0/generated/azure_cognitiveservices_face/models/snapshot.rb +136 -0
  58. data/lib/1.0/generated/azure_cognitiveservices_face/models/snapshot_apply_mode.rb +15 -0
  59. data/lib/1.0/generated/azure_cognitiveservices_face/models/snapshot_object_type.rb +18 -0
  60. data/lib/1.0/generated/azure_cognitiveservices_face/models/take_snapshot_request.rb +101 -0
  61. data/lib/1.0/generated/azure_cognitiveservices_face/models/training_status.rb +107 -0
  62. data/lib/1.0/generated/azure_cognitiveservices_face/models/training_status_type.rb +18 -0
  63. data/lib/1.0/generated/azure_cognitiveservices_face/models/update_face_request.rb +50 -0
  64. data/lib/1.0/generated/azure_cognitiveservices_face/models/update_snapshot_request.rb +73 -0
  65. data/lib/1.0/generated/azure_cognitiveservices_face/models/verify_face_to_face_request.rb +57 -0
  66. data/lib/1.0/generated/azure_cognitiveservices_face/models/verify_face_to_person_request.rb +95 -0
  67. data/lib/1.0/generated/azure_cognitiveservices_face/models/verify_result.rb +62 -0
  68. data/lib/1.0/generated/azure_cognitiveservices_face/module_definition.rb +9 -0
  69. data/lib/1.0/generated/azure_cognitiveservices_face/person_group_operations.rb +865 -0
  70. data/lib/1.0/generated/azure_cognitiveservices_face/person_group_person.rb +1528 -0
  71. data/lib/1.0/generated/azure_cognitiveservices_face/snapshot_operations.rb +983 -0
  72. data/lib/1.0/generated/azure_cognitiveservices_face.rb +94 -0
  73. data/lib/azure_cognitiveservices_face.rb +6 -0
  74. data/lib/module_definition.rb +7 -0
  75. data/lib/profiles/latest/face_latest_profile_client.rb +38 -0
  76. data/lib/profiles/latest/face_module_definition.rb +8 -0
  77. data/lib/profiles/latest/modules/face_profile_module.rb +309 -0
  78. data/lib/version.rb +7 -0
  79. metadata +196 -0
@@ -0,0 +1,886 @@
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::CognitiveServices::Face::V1_0
7
+ #
8
+ # An API for face detection, verification, and identification.
9
+ #
10
+ class LargePersonGroupOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the LargePersonGroupOperations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [FaceClient] reference to the FaceClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Create a new large person group with user-specified largePersonGroupId, name,
26
+ # an optional userData and recognitionModel.
27
+ # <br /> A large person group is the container of the uploaded person data,
28
+ # including face recognition feature, and up to 1,000,000
29
+ # people.
30
+ # <br /> After creation, use [LargePersonGroup Person -
31
+ # Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
32
+ # to add person into the group, and call [LargePersonGroup -
33
+ # Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
34
+ # to get this group ready for [Face -
35
+ # Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
36
+ # <br /> No image will be stored. Only the person's extracted face features and
37
+ # userData will be stored on server until [LargePersonGroup Person -
38
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
39
+ # or [LargePersonGroup -
40
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
41
+ # is called.
42
+ # <br/>'recognitionModel' should be specified to associate with this large
43
+ # person group. The default value for 'recognitionModel' is 'recognition_01',
44
+ # if the latest model needed, please explicitly specify the model you need in
45
+ # this parameter. New faces that are added to an existing large person group
46
+ # will use the recognition model that's already associated with the collection.
47
+ # Existing face features in a large person group can't be updated to features
48
+ # extracted by another version of recognition model.
49
+ # * 'recognition_01': The default recognition model for [LargePersonGroup -
50
+ # Create](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d).
51
+ # All those large person groups created before 2019 March are bonded with this
52
+ # recognition model.
53
+ # * 'recognition_02': Recognition model released in 2019 March.
54
+ # 'recognition_02' is recommended since its overall accuracy is improved
55
+ # compared with 'recognition_01'.
56
+ #
57
+ # Large person group quota:
58
+ # * Free-tier subscription quota: 1,000 large person groups.
59
+ # * S0-tier subscription quota: 1,000,000 large person groups.
60
+ #
61
+ # @param large_person_group_id [String] Id referencing a particular large
62
+ # person group.
63
+ # @param name [String] User defined name, maximum length is 128.
64
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
65
+ # @param recognition_model [RecognitionModel] Possible values include:
66
+ # 'recognition_01', 'recognition_02'
67
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
68
+ # will be added to the HTTP request.
69
+ #
70
+ #
71
+ def create(large_person_group_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
72
+ response = create_async(large_person_group_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value!
73
+ nil
74
+ end
75
+
76
+ #
77
+ # Create a new large person group with user-specified largePersonGroupId, name,
78
+ # an optional userData and recognitionModel.
79
+ # <br /> A large person group is the container of the uploaded person data,
80
+ # including face recognition feature, and up to 1,000,000
81
+ # people.
82
+ # <br /> After creation, use [LargePersonGroup Person -
83
+ # Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
84
+ # to add person into the group, and call [LargePersonGroup -
85
+ # Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
86
+ # to get this group ready for [Face -
87
+ # Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
88
+ # <br /> No image will be stored. Only the person's extracted face features and
89
+ # userData will be stored on server until [LargePersonGroup Person -
90
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
91
+ # or [LargePersonGroup -
92
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
93
+ # is called.
94
+ # <br/>'recognitionModel' should be specified to associate with this large
95
+ # person group. The default value for 'recognitionModel' is 'recognition_01',
96
+ # if the latest model needed, please explicitly specify the model you need in
97
+ # this parameter. New faces that are added to an existing large person group
98
+ # will use the recognition model that's already associated with the collection.
99
+ # Existing face features in a large person group can't be updated to features
100
+ # extracted by another version of recognition model.
101
+ # * 'recognition_01': The default recognition model for [LargePersonGroup -
102
+ # Create](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d).
103
+ # All those large person groups created before 2019 March are bonded with this
104
+ # recognition model.
105
+ # * 'recognition_02': Recognition model released in 2019 March.
106
+ # 'recognition_02' is recommended since its overall accuracy is improved
107
+ # compared with 'recognition_01'.
108
+ #
109
+ # Large person group quota:
110
+ # * Free-tier subscription quota: 1,000 large person groups.
111
+ # * S0-tier subscription quota: 1,000,000 large person groups.
112
+ #
113
+ # @param large_person_group_id [String] Id referencing a particular large
114
+ # person group.
115
+ # @param name [String] User defined name, maximum length is 128.
116
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
117
+ # @param recognition_model [RecognitionModel] Possible values include:
118
+ # 'recognition_01', 'recognition_02'
119
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
120
+ # will be added to the HTTP request.
121
+ #
122
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
123
+ #
124
+ def create_with_http_info(large_person_group_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
125
+ create_async(large_person_group_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value!
126
+ end
127
+
128
+ #
129
+ # Create a new large person group with user-specified largePersonGroupId, name,
130
+ # an optional userData and recognitionModel.
131
+ # <br /> A large person group is the container of the uploaded person data,
132
+ # including face recognition feature, and up to 1,000,000
133
+ # people.
134
+ # <br /> After creation, use [LargePersonGroup Person -
135
+ # Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
136
+ # to add person into the group, and call [LargePersonGroup -
137
+ # Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
138
+ # to get this group ready for [Face -
139
+ # Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
140
+ # <br /> No image will be stored. Only the person's extracted face features and
141
+ # userData will be stored on server until [LargePersonGroup Person -
142
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
143
+ # or [LargePersonGroup -
144
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
145
+ # is called.
146
+ # <br/>'recognitionModel' should be specified to associate with this large
147
+ # person group. The default value for 'recognitionModel' is 'recognition_01',
148
+ # if the latest model needed, please explicitly specify the model you need in
149
+ # this parameter. New faces that are added to an existing large person group
150
+ # will use the recognition model that's already associated with the collection.
151
+ # Existing face features in a large person group can't be updated to features
152
+ # extracted by another version of recognition model.
153
+ # * 'recognition_01': The default recognition model for [LargePersonGroup -
154
+ # Create](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d).
155
+ # All those large person groups created before 2019 March are bonded with this
156
+ # recognition model.
157
+ # * 'recognition_02': Recognition model released in 2019 March.
158
+ # 'recognition_02' is recommended since its overall accuracy is improved
159
+ # compared with 'recognition_01'.
160
+ #
161
+ # Large person group quota:
162
+ # * Free-tier subscription quota: 1,000 large person groups.
163
+ # * S0-tier subscription quota: 1,000,000 large person groups.
164
+ #
165
+ # @param large_person_group_id [String] Id referencing a particular large
166
+ # person group.
167
+ # @param name [String] User defined name, maximum length is 128.
168
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
169
+ # @param recognition_model [RecognitionModel] Possible values include:
170
+ # 'recognition_01', 'recognition_02'
171
+ # @param [Hash{String => String}] A hash of custom headers that will be added
172
+ # to the HTTP request.
173
+ #
174
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
175
+ #
176
+ def create_async(large_person_group_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
177
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
178
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
179
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
180
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
181
+ fail ArgumentError, "'name' should satisfy the constraint - 'MaxLength': '128'" if !name.nil? && name.length > 128
182
+ fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
183
+
184
+ body = Azure::CognitiveServices::Face::V1_0::Models::MetaDataContract.new
185
+ unless name.nil? && user_data.nil? && recognition_model.nil?
186
+ body.name = name
187
+ body.user_data = user_data
188
+ body.recognition_model = recognition_model
189
+ end
190
+
191
+ request_headers = {}
192
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
193
+
194
+ # Set Headers
195
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
196
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
197
+
198
+ # Serialize Request
199
+ request_mapper = Azure::CognitiveServices::Face::V1_0::Models::MetaDataContract.mapper()
200
+ request_content = @client.serialize(request_mapper, body)
201
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
202
+
203
+ path_template = 'largepersongroups/{largePersonGroupId}'
204
+
205
+ request_url = @base_url || @client.base_url
206
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
207
+
208
+ options = {
209
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
210
+ path_params: {'largePersonGroupId' => large_person_group_id},
211
+ body: request_content,
212
+ headers: request_headers.merge(custom_headers || {}),
213
+ base_url: request_url
214
+ }
215
+ promise = @client.make_request_async(:put, path_template, options)
216
+
217
+ promise = promise.then do |result|
218
+ http_response = result.response
219
+ status_code = http_response.status
220
+ response_content = http_response.body
221
+ unless status_code == 200
222
+ error_model = JSON.load(response_content)
223
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
224
+ end
225
+
226
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
227
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
228
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
229
+
230
+ result
231
+ end
232
+
233
+ promise.execute
234
+ end
235
+
236
+ #
237
+ # Delete an existing large person group. Persisted face features of all people
238
+ # in the large person group will also be deleted.
239
+ #
240
+ # @param large_person_group_id [String] Id referencing a particular large
241
+ # person group.
242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
243
+ # will be added to the HTTP request.
244
+ #
245
+ #
246
+ def delete(large_person_group_id, custom_headers:nil)
247
+ response = delete_async(large_person_group_id, custom_headers:custom_headers).value!
248
+ nil
249
+ end
250
+
251
+ #
252
+ # Delete an existing large person group. Persisted face features of all people
253
+ # in the large person group will also be deleted.
254
+ #
255
+ # @param large_person_group_id [String] Id referencing a particular large
256
+ # person group.
257
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
258
+ # will be added to the HTTP request.
259
+ #
260
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
261
+ #
262
+ def delete_with_http_info(large_person_group_id, custom_headers:nil)
263
+ delete_async(large_person_group_id, custom_headers:custom_headers).value!
264
+ end
265
+
266
+ #
267
+ # Delete an existing large person group. Persisted face features of all people
268
+ # in the large person group will also be deleted.
269
+ #
270
+ # @param large_person_group_id [String] Id referencing a particular large
271
+ # person group.
272
+ # @param [Hash{String => String}] A hash of custom headers that will be added
273
+ # to the HTTP request.
274
+ #
275
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
276
+ #
277
+ def delete_async(large_person_group_id, custom_headers:nil)
278
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
279
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
280
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
281
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
282
+
283
+
284
+ request_headers = {}
285
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
286
+
287
+ # Set Headers
288
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
289
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
290
+ path_template = 'largepersongroups/{largePersonGroupId}'
291
+
292
+ request_url = @base_url || @client.base_url
293
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
294
+
295
+ options = {
296
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
297
+ path_params: {'largePersonGroupId' => large_person_group_id},
298
+ headers: request_headers.merge(custom_headers || {}),
299
+ base_url: request_url
300
+ }
301
+ promise = @client.make_request_async(:delete, path_template, options)
302
+
303
+ promise = promise.then do |result|
304
+ http_response = result.response
305
+ status_code = http_response.status
306
+ response_content = http_response.body
307
+ unless status_code == 200
308
+ error_model = JSON.load(response_content)
309
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
310
+ end
311
+
312
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
313
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
314
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
315
+
316
+ result
317
+ end
318
+
319
+ promise.execute
320
+ end
321
+
322
+ #
323
+ # Retrieve the information of a large person group, including its name,
324
+ # userData and recognitionModel. This API returns large person group
325
+ # information only, use [LargePersonGroup Person -
326
+ # List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
327
+ # instead to retrieve person information under the large person group.
328
+ #
329
+ #
330
+ # @param large_person_group_id [String] Id referencing a particular large
331
+ # person group.
332
+ # @param return_recognition_model [Boolean] A value indicating whether the
333
+ # operation should return 'recognitionModel' in response.
334
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
335
+ # will be added to the HTTP request.
336
+ #
337
+ # @return [LargePersonGroup] operation results.
338
+ #
339
+ def get(large_person_group_id, return_recognition_model:false, custom_headers:nil)
340
+ response = get_async(large_person_group_id, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
341
+ response.body unless response.nil?
342
+ end
343
+
344
+ #
345
+ # Retrieve the information of a large person group, including its name,
346
+ # userData and recognitionModel. This API returns large person group
347
+ # information only, use [LargePersonGroup Person -
348
+ # List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
349
+ # instead to retrieve person information under the large person group.
350
+ #
351
+ #
352
+ # @param large_person_group_id [String] Id referencing a particular large
353
+ # person group.
354
+ # @param return_recognition_model [Boolean] A value indicating whether the
355
+ # operation should return 'recognitionModel' in response.
356
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
357
+ # will be added to the HTTP request.
358
+ #
359
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
360
+ #
361
+ def get_with_http_info(large_person_group_id, return_recognition_model:false, custom_headers:nil)
362
+ get_async(large_person_group_id, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
363
+ end
364
+
365
+ #
366
+ # Retrieve the information of a large person group, including its name,
367
+ # userData and recognitionModel. This API returns large person group
368
+ # information only, use [LargePersonGroup Person -
369
+ # List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
370
+ # instead to retrieve person information under the large person group.
371
+ #
372
+ #
373
+ # @param large_person_group_id [String] Id referencing a particular large
374
+ # person group.
375
+ # @param return_recognition_model [Boolean] A value indicating whether the
376
+ # operation should return 'recognitionModel' in response.
377
+ # @param [Hash{String => String}] A hash of custom headers that will be added
378
+ # to the HTTP request.
379
+ #
380
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
381
+ #
382
+ def get_async(large_person_group_id, return_recognition_model:false, custom_headers:nil)
383
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
384
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
385
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
386
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
387
+
388
+
389
+ request_headers = {}
390
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
391
+
392
+ # Set Headers
393
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
394
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
395
+ path_template = 'largepersongroups/{largePersonGroupId}'
396
+
397
+ request_url = @base_url || @client.base_url
398
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
399
+
400
+ options = {
401
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
402
+ path_params: {'largePersonGroupId' => large_person_group_id},
403
+ query_params: {'returnRecognitionModel' => return_recognition_model},
404
+ headers: request_headers.merge(custom_headers || {}),
405
+ base_url: request_url
406
+ }
407
+ promise = @client.make_request_async(:get, path_template, options)
408
+
409
+ promise = promise.then do |result|
410
+ http_response = result.response
411
+ status_code = http_response.status
412
+ response_content = http_response.body
413
+ unless status_code == 200
414
+ error_model = JSON.load(response_content)
415
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
416
+ end
417
+
418
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
419
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
420
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
421
+ # Deserialize Response
422
+ if status_code == 200
423
+ begin
424
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
425
+ result_mapper = Azure::CognitiveServices::Face::V1_0::Models::LargePersonGroup.mapper()
426
+ result.body = @client.deserialize(result_mapper, parsed_response)
427
+ rescue Exception => e
428
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
429
+ end
430
+ end
431
+
432
+ result
433
+ end
434
+
435
+ promise.execute
436
+ end
437
+
438
+ #
439
+ # Update an existing large person group's display name and userData. The
440
+ # properties which does not appear in request body will not be updated.
441
+ #
442
+ # @param large_person_group_id [String] Id referencing a particular large
443
+ # person group.
444
+ # @param name [String] User defined name, maximum length is 128.
445
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
446
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
447
+ # will be added to the HTTP request.
448
+ #
449
+ #
450
+ def update(large_person_group_id, name:nil, user_data:nil, custom_headers:nil)
451
+ response = update_async(large_person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
452
+ nil
453
+ end
454
+
455
+ #
456
+ # Update an existing large person group's display name and userData. The
457
+ # properties which does not appear in request body will not be updated.
458
+ #
459
+ # @param large_person_group_id [String] Id referencing a particular large
460
+ # person group.
461
+ # @param name [String] User defined name, maximum length is 128.
462
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
463
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
464
+ # will be added to the HTTP request.
465
+ #
466
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
467
+ #
468
+ def update_with_http_info(large_person_group_id, name:nil, user_data:nil, custom_headers:nil)
469
+ update_async(large_person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
470
+ end
471
+
472
+ #
473
+ # Update an existing large person group's display name and userData. The
474
+ # properties which does not appear in request body will not be updated.
475
+ #
476
+ # @param large_person_group_id [String] Id referencing a particular large
477
+ # person group.
478
+ # @param name [String] User defined name, maximum length is 128.
479
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
480
+ # @param [Hash{String => String}] A hash of custom headers that will be added
481
+ # to the HTTP request.
482
+ #
483
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
484
+ #
485
+ def update_async(large_person_group_id, name:nil, user_data:nil, custom_headers:nil)
486
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
487
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
488
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
489
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
490
+ fail ArgumentError, "'name' should satisfy the constraint - 'MaxLength': '128'" if !name.nil? && name.length > 128
491
+ fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
492
+
493
+ body = Azure::CognitiveServices::Face::V1_0::Models::NameAndUserDataContract.new
494
+ unless name.nil? && user_data.nil?
495
+ body.name = name
496
+ body.user_data = user_data
497
+ end
498
+
499
+ request_headers = {}
500
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
501
+
502
+ # Set Headers
503
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
504
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
505
+
506
+ # Serialize Request
507
+ request_mapper = Azure::CognitiveServices::Face::V1_0::Models::NameAndUserDataContract.mapper()
508
+ request_content = @client.serialize(request_mapper, body)
509
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
510
+
511
+ path_template = 'largepersongroups/{largePersonGroupId}'
512
+
513
+ request_url = @base_url || @client.base_url
514
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
515
+
516
+ options = {
517
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
518
+ path_params: {'largePersonGroupId' => large_person_group_id},
519
+ body: request_content,
520
+ headers: request_headers.merge(custom_headers || {}),
521
+ base_url: request_url
522
+ }
523
+ promise = @client.make_request_async(:patch, path_template, options)
524
+
525
+ promise = promise.then do |result|
526
+ http_response = result.response
527
+ status_code = http_response.status
528
+ response_content = http_response.body
529
+ unless status_code == 200
530
+ error_model = JSON.load(response_content)
531
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
532
+ end
533
+
534
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
535
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
536
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
537
+
538
+ result
539
+ end
540
+
541
+ promise.execute
542
+ end
543
+
544
+ #
545
+ # Retrieve the training status of a large person group (completed or ongoing).
546
+ #
547
+ # @param large_person_group_id [String] Id referencing a particular large
548
+ # person group.
549
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
550
+ # will be added to the HTTP request.
551
+ #
552
+ # @return [TrainingStatus] operation results.
553
+ #
554
+ def get_training_status(large_person_group_id, custom_headers:nil)
555
+ response = get_training_status_async(large_person_group_id, custom_headers:custom_headers).value!
556
+ response.body unless response.nil?
557
+ end
558
+
559
+ #
560
+ # Retrieve the training status of a large person group (completed or ongoing).
561
+ #
562
+ # @param large_person_group_id [String] Id referencing a particular large
563
+ # person group.
564
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
565
+ # will be added to the HTTP request.
566
+ #
567
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
568
+ #
569
+ def get_training_status_with_http_info(large_person_group_id, custom_headers:nil)
570
+ get_training_status_async(large_person_group_id, custom_headers:custom_headers).value!
571
+ end
572
+
573
+ #
574
+ # Retrieve the training status of a large person group (completed or ongoing).
575
+ #
576
+ # @param large_person_group_id [String] Id referencing a particular large
577
+ # person group.
578
+ # @param [Hash{String => String}] A hash of custom headers that will be added
579
+ # to the HTTP request.
580
+ #
581
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
582
+ #
583
+ def get_training_status_async(large_person_group_id, custom_headers:nil)
584
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
585
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
586
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
587
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
588
+
589
+
590
+ request_headers = {}
591
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
592
+
593
+ # Set Headers
594
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
595
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
596
+ path_template = 'largepersongroups/{largePersonGroupId}/training'
597
+
598
+ request_url = @base_url || @client.base_url
599
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
600
+
601
+ options = {
602
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
603
+ path_params: {'largePersonGroupId' => large_person_group_id},
604
+ headers: request_headers.merge(custom_headers || {}),
605
+ base_url: request_url
606
+ }
607
+ promise = @client.make_request_async(:get, path_template, options)
608
+
609
+ promise = promise.then do |result|
610
+ http_response = result.response
611
+ status_code = http_response.status
612
+ response_content = http_response.body
613
+ unless status_code == 200
614
+ error_model = JSON.load(response_content)
615
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
616
+ end
617
+
618
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
619
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
620
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
621
+ # Deserialize Response
622
+ if status_code == 200
623
+ begin
624
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
625
+ result_mapper = Azure::CognitiveServices::Face::V1_0::Models::TrainingStatus.mapper()
626
+ result.body = @client.deserialize(result_mapper, parsed_response)
627
+ rescue Exception => e
628
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
629
+ end
630
+ end
631
+
632
+ result
633
+ end
634
+
635
+ promise.execute
636
+ end
637
+
638
+ #
639
+ # List all existing large person groups’ largePersonGroupId, name, userData and
640
+ # recognitionModel.<br />
641
+ # * Large person groups are stored in alphabetical order of largePersonGroupId.
642
+ # * "start" parameter (string, optional) is a user-provided largePersonGroupId
643
+ # value that returned entries have larger ids by string comparison. "start" set
644
+ # to empty to indicate return from the first item.
645
+ # * "top" parameter (int, optional) specifies the number of entries to return.
646
+ # A maximal of 1000 entries can be returned in one call. To fetch more, you can
647
+ # specify "start" with the last returned entry’s Id of the current call.
648
+ # <br />
649
+ # For example, total 5 large person groups: "group1", ..., "group5".
650
+ # <br /> "start=&top=" will return all 5 groups.
651
+ # <br /> "start=&top=2" will return "group1", "group2".
652
+ # <br /> "start=group2&top=3" will return "group3", "group4", "group5".
653
+ #
654
+ #
655
+ # @param start [String] List large person groups from the least
656
+ # largePersonGroupId greater than the "start".
657
+ # @param top [Integer] The number of large person groups to list.
658
+ # @param return_recognition_model [Boolean] A value indicating whether the
659
+ # operation should return 'recognitionModel' in response.
660
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
661
+ # will be added to the HTTP request.
662
+ #
663
+ # @return [Array] operation results.
664
+ #
665
+ def list(start:nil, top:1000, return_recognition_model:false, custom_headers:nil)
666
+ response = list_async(start:start, top:top, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
667
+ response.body unless response.nil?
668
+ end
669
+
670
+ #
671
+ # List all existing large person groups’ largePersonGroupId, name, userData and
672
+ # recognitionModel.<br />
673
+ # * Large person groups are stored in alphabetical order of largePersonGroupId.
674
+ # * "start" parameter (string, optional) is a user-provided largePersonGroupId
675
+ # value that returned entries have larger ids by string comparison. "start" set
676
+ # to empty to indicate return from the first item.
677
+ # * "top" parameter (int, optional) specifies the number of entries to return.
678
+ # A maximal of 1000 entries can be returned in one call. To fetch more, you can
679
+ # specify "start" with the last returned entry’s Id of the current call.
680
+ # <br />
681
+ # For example, total 5 large person groups: "group1", ..., "group5".
682
+ # <br /> "start=&top=" will return all 5 groups.
683
+ # <br /> "start=&top=2" will return "group1", "group2".
684
+ # <br /> "start=group2&top=3" will return "group3", "group4", "group5".
685
+ #
686
+ #
687
+ # @param start [String] List large person groups from the least
688
+ # largePersonGroupId greater than the "start".
689
+ # @param top [Integer] The number of large person groups to list.
690
+ # @param return_recognition_model [Boolean] A value indicating whether the
691
+ # operation should return 'recognitionModel' in response.
692
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
693
+ # will be added to the HTTP request.
694
+ #
695
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
696
+ #
697
+ def list_with_http_info(start:nil, top:1000, return_recognition_model:false, custom_headers:nil)
698
+ list_async(start:start, top:top, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
699
+ end
700
+
701
+ #
702
+ # List all existing large person groups’ largePersonGroupId, name, userData and
703
+ # recognitionModel.<br />
704
+ # * Large person groups are stored in alphabetical order of largePersonGroupId.
705
+ # * "start" parameter (string, optional) is a user-provided largePersonGroupId
706
+ # value that returned entries have larger ids by string comparison. "start" set
707
+ # to empty to indicate return from the first item.
708
+ # * "top" parameter (int, optional) specifies the number of entries to return.
709
+ # A maximal of 1000 entries can be returned in one call. To fetch more, you can
710
+ # specify "start" with the last returned entry’s Id of the current call.
711
+ # <br />
712
+ # For example, total 5 large person groups: "group1", ..., "group5".
713
+ # <br /> "start=&top=" will return all 5 groups.
714
+ # <br /> "start=&top=2" will return "group1", "group2".
715
+ # <br /> "start=group2&top=3" will return "group3", "group4", "group5".
716
+ #
717
+ #
718
+ # @param start [String] List large person groups from the least
719
+ # largePersonGroupId greater than the "start".
720
+ # @param top [Integer] The number of large person groups to list.
721
+ # @param return_recognition_model [Boolean] A value indicating whether the
722
+ # operation should return 'recognitionModel' in response.
723
+ # @param [Hash{String => String}] A hash of custom headers that will be added
724
+ # to the HTTP request.
725
+ #
726
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
727
+ #
728
+ def list_async(start:nil, top:1000, return_recognition_model:false, custom_headers:nil)
729
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
730
+ fail ArgumentError, "'start' should satisfy the constraint - 'MaxLength': '64'" if !start.nil? && start.length > 64
731
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
732
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
733
+
734
+
735
+ request_headers = {}
736
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
737
+
738
+ # Set Headers
739
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
740
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
741
+ path_template = 'largepersongroups'
742
+
743
+ request_url = @base_url || @client.base_url
744
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
745
+
746
+ options = {
747
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
748
+ query_params: {'start' => start,'top' => top,'returnRecognitionModel' => return_recognition_model},
749
+ headers: request_headers.merge(custom_headers || {}),
750
+ base_url: request_url
751
+ }
752
+ promise = @client.make_request_async(:get, path_template, options)
753
+
754
+ promise = promise.then do |result|
755
+ http_response = result.response
756
+ status_code = http_response.status
757
+ response_content = http_response.body
758
+ unless status_code == 200
759
+ error_model = JSON.load(response_content)
760
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
761
+ end
762
+
763
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
764
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
765
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
766
+ # Deserialize Response
767
+ if status_code == 200
768
+ begin
769
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
770
+ result_mapper = {
771
+ client_side_validation: true,
772
+ required: false,
773
+ serialized_name: 'parsed_response',
774
+ type: {
775
+ name: 'Sequence',
776
+ element: {
777
+ client_side_validation: true,
778
+ required: false,
779
+ serialized_name: 'LargePersonGroupElementType',
780
+ type: {
781
+ name: 'Composite',
782
+ class_name: 'LargePersonGroup'
783
+ }
784
+ }
785
+ }
786
+ }
787
+ result.body = @client.deserialize(result_mapper, parsed_response)
788
+ rescue Exception => e
789
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
790
+ end
791
+ end
792
+
793
+ result
794
+ end
795
+
796
+ promise.execute
797
+ end
798
+
799
+ #
800
+ # Queue a large person group training task, the training task may not be
801
+ # started immediately.
802
+ #
803
+ # @param large_person_group_id [String] Id referencing a particular large
804
+ # person group.
805
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
806
+ # will be added to the HTTP request.
807
+ #
808
+ #
809
+ def train(large_person_group_id, custom_headers:nil)
810
+ response = train_async(large_person_group_id, custom_headers:custom_headers).value!
811
+ nil
812
+ end
813
+
814
+ #
815
+ # Queue a large person group training task, the training task may not be
816
+ # started immediately.
817
+ #
818
+ # @param large_person_group_id [String] Id referencing a particular large
819
+ # person group.
820
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
821
+ # will be added to the HTTP request.
822
+ #
823
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
824
+ #
825
+ def train_with_http_info(large_person_group_id, custom_headers:nil)
826
+ train_async(large_person_group_id, custom_headers:custom_headers).value!
827
+ end
828
+
829
+ #
830
+ # Queue a large person group training task, the training task may not be
831
+ # started immediately.
832
+ #
833
+ # @param large_person_group_id [String] Id referencing a particular large
834
+ # person group.
835
+ # @param [Hash{String => String}] A hash of custom headers that will be added
836
+ # to the HTTP request.
837
+ #
838
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
839
+ #
840
+ def train_async(large_person_group_id, custom_headers:nil)
841
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
842
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
843
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
844
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
845
+
846
+
847
+ request_headers = {}
848
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
849
+
850
+ # Set Headers
851
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
852
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
853
+ path_template = 'largepersongroups/{largePersonGroupId}/train'
854
+
855
+ request_url = @base_url || @client.base_url
856
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
857
+
858
+ options = {
859
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
860
+ path_params: {'largePersonGroupId' => large_person_group_id},
861
+ headers: request_headers.merge(custom_headers || {}),
862
+ base_url: request_url
863
+ }
864
+ promise = @client.make_request_async(:post, path_template, options)
865
+
866
+ promise = promise.then do |result|
867
+ http_response = result.response
868
+ status_code = http_response.status
869
+ response_content = http_response.body
870
+ unless status_code == 202
871
+ error_model = JSON.load(response_content)
872
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
873
+ end
874
+
875
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
876
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
877
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
878
+
879
+ result
880
+ end
881
+
882
+ promise.execute
883
+ end
884
+
885
+ end
886
+ end