azure_cognitiveservices_face 0.17.1 → 0.18.0

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/1.0/generated/azure_cognitiveservices_face.rb +38 -22
  3. data/lib/1.0/generated/azure_cognitiveservices_face/face.rb +554 -77
  4. data/lib/1.0/generated/azure_cognitiveservices_face/face_client.rb +24 -5
  5. data/lib/1.0/generated/azure_cognitiveservices_face/face_list_operations.rb +169 -36
  6. data/lib/1.0/generated/azure_cognitiveservices_face/large_face_list_operations.rb +1559 -0
  7. data/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb +854 -0
  8. data/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb +1151 -0
  9. data/lib/1.0/generated/azure_cognitiveservices_face/models/apply_snapshot_request.rb +69 -0
  10. data/lib/1.0/generated/azure_cognitiveservices_face/models/detected_face.rb +13 -0
  11. data/lib/1.0/generated/azure_cognitiveservices_face/models/face_attributes.rb +1 -1
  12. data/lib/1.0/generated/azure_cognitiveservices_face/models/face_list.rb +10 -1
  13. data/lib/1.0/generated/azure_cognitiveservices_face/models/find_similar_request.rb +23 -1
  14. data/lib/1.0/generated/azure_cognitiveservices_face/models/gender.rb +0 -1
  15. data/lib/1.0/generated/azure_cognitiveservices_face/models/identify_request.rb +34 -16
  16. data/lib/1.0/generated/azure_cognitiveservices_face/models/large_face_list.rb +81 -0
  17. data/lib/1.0/generated/azure_cognitiveservices_face/models/large_person_group.rb +81 -0
  18. data/lib/1.0/generated/azure_cognitiveservices_face/models/meta_data_contract.rb +72 -0
  19. data/lib/1.0/generated/azure_cognitiveservices_face/models/name_and_user_data_contract.rb +1 -1
  20. data/lib/1.0/generated/azure_cognitiveservices_face/models/operation_status.rb +112 -0
  21. data/lib/1.0/generated/azure_cognitiveservices_face/models/operation_status_type.rb +18 -0
  22. data/lib/1.0/generated/azure_cognitiveservices_face/models/person_group.rb +11 -2
  23. data/lib/1.0/generated/azure_cognitiveservices_face/models/recognition_model.rb +16 -0
  24. data/lib/1.0/generated/azure_cognitiveservices_face/models/snapshot.rb +136 -0
  25. data/lib/1.0/generated/azure_cognitiveservices_face/models/snapshot_apply_mode.rb +15 -0
  26. data/lib/1.0/generated/azure_cognitiveservices_face/models/snapshot_object_type.rb +18 -0
  27. data/lib/1.0/generated/azure_cognitiveservices_face/models/take_snapshot_request.rb +101 -0
  28. data/lib/1.0/generated/azure_cognitiveservices_face/models/training_status.rb +25 -7
  29. data/lib/1.0/generated/azure_cognitiveservices_face/models/{update_person_face_request.rb → update_face_request.rb} +5 -5
  30. data/lib/1.0/generated/azure_cognitiveservices_face/models/update_snapshot_request.rb +73 -0
  31. data/lib/1.0/generated/azure_cognitiveservices_face/models/verify_face_to_face_request.rb +1 -1
  32. data/lib/1.0/generated/azure_cognitiveservices_face/models/verify_face_to_person_request.rb +27 -7
  33. data/lib/1.0/generated/azure_cognitiveservices_face/person_group_operations.rb +203 -34
  34. data/lib/1.0/generated/azure_cognitiveservices_face/person_group_person.rb +49 -29
  35. data/lib/1.0/generated/azure_cognitiveservices_face/snapshot_operations.rb +969 -0
  36. data/lib/profiles/latest/modules/face_profile_module.rb +125 -69
  37. data/lib/version.rb +1 -1
  38. metadata +19 -3
@@ -64,6 +64,7 @@ module Azure::CognitiveServices::Face::V1_0
64
64
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
65
  #
66
66
  def create_async(person_group_id, name:nil, user_data:nil, custom_headers:nil)
67
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
67
68
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
68
69
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
69
70
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -91,6 +92,7 @@ module Azure::CognitiveServices::Face::V1_0
91
92
  path_template = 'persongroups/{personGroupId}/persons'
92
93
 
93
94
  request_url = @base_url || @client.base_url
95
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
94
96
 
95
97
  options = {
96
98
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -183,6 +185,7 @@ module Azure::CognitiveServices::Face::V1_0
183
185
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
184
186
  #
185
187
  def list_async(person_group_id, start:nil, top:nil, custom_headers:nil)
188
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
186
189
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
187
190
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
188
191
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -199,6 +202,7 @@ module Azure::CognitiveServices::Face::V1_0
199
202
  path_template = 'persongroups/{personGroupId}/persons'
200
203
 
201
204
  request_url = @base_url || @client.base_url
205
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
202
206
 
203
207
  options = {
204
208
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -253,8 +257,8 @@ module Azure::CognitiveServices::Face::V1_0
253
257
  end
254
258
 
255
259
  #
256
- # Delete an existing person from a person group. Persisted face images of the
257
- # person will also be deleted.
260
+ # Delete an existing person from a person group. All stored person data, and
261
+ # face features in the person entry will be deleted.
258
262
  #
259
263
  # @param person_group_id [String] Id referencing a particular person group.
260
264
  # @param person_id Id referencing a particular person.
@@ -268,8 +272,8 @@ module Azure::CognitiveServices::Face::V1_0
268
272
  end
269
273
 
270
274
  #
271
- # Delete an existing person from a person group. Persisted face images of the
272
- # person will also be deleted.
275
+ # Delete an existing person from a person group. All stored person data, and
276
+ # face features in the person entry will be deleted.
273
277
  #
274
278
  # @param person_group_id [String] Id referencing a particular person group.
275
279
  # @param person_id Id referencing a particular person.
@@ -283,8 +287,8 @@ module Azure::CognitiveServices::Face::V1_0
283
287
  end
284
288
 
285
289
  #
286
- # Delete an existing person from a person group. Persisted face images of the
287
- # person will also be deleted.
290
+ # Delete an existing person from a person group. All stored person data, and
291
+ # face features in the person entry will be deleted.
288
292
  #
289
293
  # @param person_group_id [String] Id referencing a particular person group.
290
294
  # @param person_id Id referencing a particular person.
@@ -294,6 +298,7 @@ module Azure::CognitiveServices::Face::V1_0
294
298
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
295
299
  #
296
300
  def delete_async(person_group_id, person_id, custom_headers:nil)
301
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
297
302
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
298
303
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
299
304
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -309,6 +314,7 @@ module Azure::CognitiveServices::Face::V1_0
309
314
  path_template = 'persongroups/{personGroupId}/persons/{personId}'
310
315
 
311
316
  request_url = @base_url || @client.base_url
317
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
312
318
 
313
319
  options = {
314
320
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -378,6 +384,7 @@ module Azure::CognitiveServices::Face::V1_0
378
384
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
379
385
  #
380
386
  def get_async(person_group_id, person_id, custom_headers:nil)
387
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
381
388
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
382
389
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
383
390
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -393,6 +400,7 @@ module Azure::CognitiveServices::Face::V1_0
393
400
  path_template = 'persongroups/{personGroupId}/persons/{personId}'
394
401
 
395
402
  request_url = @base_url || @client.base_url
403
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
396
404
 
397
405
  options = {
398
406
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -474,6 +482,7 @@ module Azure::CognitiveServices::Face::V1_0
474
482
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
475
483
  #
476
484
  def update_async(person_group_id, person_id, name:nil, user_data:nil, custom_headers:nil)
485
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
477
486
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
478
487
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
479
488
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -502,6 +511,7 @@ module Azure::CognitiveServices::Face::V1_0
502
511
  path_template = 'persongroups/{personGroupId}/persons/{personId}'
503
512
 
504
513
  request_url = @base_url || @client.base_url
514
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
505
515
 
506
516
  options = {
507
517
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -530,8 +540,8 @@ module Azure::CognitiveServices::Face::V1_0
530
540
  end
531
541
 
532
542
  #
533
- # Delete a face from a person. Relative image for the persisted face will also
534
- # be deleted.
543
+ # Delete a face from a person. Relative feature for the persisted face will
544
+ # also be deleted.
535
545
  #
536
546
  # @param person_group_id [String] Id referencing a particular person group.
537
547
  # @param person_id Id referencing a particular person.
@@ -547,8 +557,8 @@ module Azure::CognitiveServices::Face::V1_0
547
557
  end
548
558
 
549
559
  #
550
- # Delete a face from a person. Relative image for the persisted face will also
551
- # be deleted.
560
+ # Delete a face from a person. Relative feature for the persisted face will
561
+ # also be deleted.
552
562
  #
553
563
  # @param person_group_id [String] Id referencing a particular person group.
554
564
  # @param person_id Id referencing a particular person.
@@ -564,8 +574,8 @@ module Azure::CognitiveServices::Face::V1_0
564
574
  end
565
575
 
566
576
  #
567
- # Delete a face from a person. Relative image for the persisted face will also
568
- # be deleted.
577
+ # Delete a face from a person. Relative feature for the persisted face will
578
+ # also be deleted.
569
579
  #
570
580
  # @param person_group_id [String] Id referencing a particular person group.
571
581
  # @param person_id Id referencing a particular person.
@@ -577,6 +587,7 @@ module Azure::CognitiveServices::Face::V1_0
577
587
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
578
588
  #
579
589
  def delete_face_async(person_group_id, person_id, persisted_face_id, custom_headers:nil)
590
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
580
591
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
581
592
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
582
593
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -590,9 +601,10 @@ module Azure::CognitiveServices::Face::V1_0
590
601
  # Set Headers
591
602
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
592
603
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
593
- path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'
604
+ path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'
594
605
 
595
606
  request_url = @base_url || @client.base_url
607
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
596
608
 
597
609
  options = {
598
610
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -668,6 +680,7 @@ module Azure::CognitiveServices::Face::V1_0
668
680
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
669
681
  #
670
682
  def get_face_async(person_group_id, person_id, persisted_face_id, custom_headers:nil)
683
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
671
684
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
672
685
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
673
686
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -681,9 +694,10 @@ module Azure::CognitiveServices::Face::V1_0
681
694
  # Set Headers
682
695
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
683
696
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
684
- path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'
697
+ path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'
685
698
 
686
699
  request_url = @base_url || @client.base_url
700
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
687
701
 
688
702
  options = {
689
703
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -771,6 +785,7 @@ module Azure::CognitiveServices::Face::V1_0
771
785
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
772
786
  #
773
787
  def update_face_async(person_group_id, person_id, persisted_face_id, user_data:nil, custom_headers:nil)
788
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
774
789
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
775
790
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
776
791
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -778,7 +793,7 @@ module Azure::CognitiveServices::Face::V1_0
778
793
  fail ArgumentError, 'persisted_face_id is nil' if persisted_face_id.nil?
779
794
  fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '1024'" if !user_data.nil? && user_data.length > 1024
780
795
 
781
- body = UpdatePersonFaceRequest.new
796
+ body = UpdateFaceRequest.new
782
797
  unless user_data.nil?
783
798
  body.user_data = user_data
784
799
  end
@@ -791,13 +806,14 @@ module Azure::CognitiveServices::Face::V1_0
791
806
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
792
807
 
793
808
  # Serialize Request
794
- request_mapper = Azure::CognitiveServices::Face::V1_0::Models::UpdatePersonFaceRequest.mapper()
809
+ request_mapper = Azure::CognitiveServices::Face::V1_0::Models::UpdateFaceRequest.mapper()
795
810
  request_content = @client.serialize(request_mapper, body)
796
811
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
797
812
 
798
- path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'
813
+ path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'
799
814
 
800
815
  request_url = @base_url || @client.base_url
816
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
801
817
 
802
818
  options = {
803
819
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -845,8 +861,8 @@ module Azure::CognitiveServices::Face::V1_0
845
861
  #
846
862
  # @return [PersistedFace] operation results.
847
863
  #
848
- def add_person_face_from_url(person_group_id, person_id, url, user_data:nil, target_face:nil, custom_headers:nil)
849
- response = add_person_face_from_url_async(person_group_id, person_id, url, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
864
+ def add_face_from_url(person_group_id, person_id, url, user_data:nil, target_face:nil, custom_headers:nil)
865
+ response = add_face_from_url_async(person_group_id, person_id, url, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
850
866
  response.body unless response.nil?
851
867
  end
852
868
 
@@ -870,8 +886,8 @@ module Azure::CognitiveServices::Face::V1_0
870
886
  #
871
887
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
872
888
  #
873
- def add_person_face_from_url_with_http_info(person_group_id, person_id, url, user_data:nil, target_face:nil, custom_headers:nil)
874
- add_person_face_from_url_async(person_group_id, person_id, url, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
889
+ def add_face_from_url_with_http_info(person_group_id, person_id, url, user_data:nil, target_face:nil, custom_headers:nil)
890
+ add_face_from_url_async(person_group_id, person_id, url, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
875
891
  end
876
892
 
877
893
  #
@@ -894,7 +910,8 @@ module Azure::CognitiveServices::Face::V1_0
894
910
  #
895
911
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
896
912
  #
897
- def add_person_face_from_url_async(person_group_id, person_id, url, user_data:nil, target_face:nil, custom_headers:nil)
913
+ def add_face_from_url_async(person_group_id, person_id, url, user_data:nil, target_face:nil, custom_headers:nil)
914
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
898
915
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
899
916
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
900
917
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -919,9 +936,10 @@ module Azure::CognitiveServices::Face::V1_0
919
936
  request_content = @client.serialize(request_mapper, image_url)
920
937
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
921
938
 
922
- path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedFaces'
939
+ path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedfaces'
923
940
 
924
941
  request_url = @base_url || @client.base_url
942
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
925
943
 
926
944
  options = {
927
945
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -980,8 +998,8 @@ module Azure::CognitiveServices::Face::V1_0
980
998
  #
981
999
  # @return [PersistedFace] operation results.
982
1000
  #
983
- def add_person_face_from_stream(person_group_id, person_id, image, user_data:nil, target_face:nil, custom_headers:nil)
984
- response = add_person_face_from_stream_async(person_group_id, person_id, image, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
1001
+ def add_face_from_stream(person_group_id, person_id, image, user_data:nil, target_face:nil, custom_headers:nil)
1002
+ response = add_face_from_stream_async(person_group_id, person_id, image, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
985
1003
  response.body unless response.nil?
986
1004
  end
987
1005
 
@@ -1005,8 +1023,8 @@ module Azure::CognitiveServices::Face::V1_0
1005
1023
  #
1006
1024
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1007
1025
  #
1008
- def add_person_face_from_stream_with_http_info(person_group_id, person_id, image, user_data:nil, target_face:nil, custom_headers:nil)
1009
- add_person_face_from_stream_async(person_group_id, person_id, image, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
1026
+ def add_face_from_stream_with_http_info(person_group_id, person_id, image, user_data:nil, target_face:nil, custom_headers:nil)
1027
+ add_face_from_stream_async(person_group_id, person_id, image, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
1010
1028
  end
1011
1029
 
1012
1030
  #
@@ -1029,7 +1047,8 @@ module Azure::CognitiveServices::Face::V1_0
1029
1047
  #
1030
1048
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1031
1049
  #
1032
- def add_person_face_from_stream_async(person_group_id, person_id, image, user_data:nil, target_face:nil, custom_headers:nil)
1050
+ def add_face_from_stream_async(person_group_id, person_id, image, user_data:nil, target_face:nil, custom_headers:nil)
1051
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
1033
1052
  fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
1034
1053
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
1035
1054
  fail ArgumentError, "'person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !person_group_id.nil? && person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
@@ -1056,9 +1075,10 @@ module Azure::CognitiveServices::Face::V1_0
1056
1075
  }
1057
1076
  request_content = @client.serialize(request_mapper, image)
1058
1077
 
1059
- path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedFaces'
1078
+ path_template = 'persongroups/{personGroupId}/persons/{personId}/persistedfaces'
1060
1079
 
1061
1080
  request_url = @base_url || @client.base_url
1081
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
1062
1082
 
1063
1083
  options = {
1064
1084
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -0,0 +1,969 @@
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 SnapshotOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the SnapshotOperations 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
+ # Submit an operation to take a snapshot of face list, large face list, person
26
+ # group or large person group, with user-specified snapshot type, source object
27
+ # id, apply scope and an optional user data.<br />
28
+ # The snapshot interfaces are for users to backup and restore their face data
29
+ # from one face subscription to another, inside same region or across regions.
30
+ # The workflow contains two phases, user first calls Snapshot - Take to create
31
+ # a copy of the source object and store it as a snapshot, then calls Snapshot -
32
+ # Apply to paste the snapshot to target subscription. The snapshots are stored
33
+ # in a centralized location (per Azure instance), so that they can be applied
34
+ # cross accounts and regions.<br />
35
+ # Taking snapshot is an asynchronous operation. An operation id can be obtained
36
+ # from the "Operation-Location" field in response header, to be used in
37
+ # OperationStatus - Get for tracking the progress of creating the snapshot. The
38
+ # snapshot id will be included in the "resourceLocation" field in
39
+ # OperationStatus - Get response when the operation status is "succeeded".<br
40
+ # />
41
+ # Snapshot taking time depends on the number of person and face entries in the
42
+ # source object. It could be in seconds, or up to several hours for 1,000,000
43
+ # persons with multiple faces.<br />
44
+ # Snapshots will be automatically expired and cleaned in 48 hours after it is
45
+ # created by Snapshot - Take. User can delete the snapshot using Snapshot -
46
+ # Delete by themselves any time before expiration.<br />
47
+ # Taking snapshot for a certain object will not block any other operations
48
+ # against the object. All read-only operations (Get/List and
49
+ # Identify/FindSimilar/Verify) can be conducted as usual. For all writable
50
+ # operations, including Add/Update/Delete the source object or its
51
+ # persons/faces and Train, they are not blocked but not recommended because
52
+ # writable updates may not be reflected on the snapshot during its taking.
53
+ # After snapshot taking is completed, all readable and writable operations can
54
+ # work as normal. Snapshot will also include the training results of the source
55
+ # object, which means target subscription the snapshot applied to does not need
56
+ # re-train the target object before calling Identify/FindSimilar.<br />
57
+ # * Free-tier subscription quota: 100 take operations per month.
58
+ # * S0-tier subscription quota: 100 take operations per day.
59
+ #
60
+ # @param type [SnapshotObjectType] User specified type for the source object to
61
+ # take snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
62
+ # LargePersonGroup are supported. Possible values include: 'FaceList',
63
+ # 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
64
+ # @param object_id [String] User specified source object id to take snapshot
65
+ # from.
66
+ # @param apply_scope User specified array of target Face subscription ids for
67
+ # the snapshot. For each snapshot, only subscriptions included in the
68
+ # applyScope of Snapshot - Take can apply it.
69
+ # @param user_data [String] User specified data about the snapshot for any
70
+ # purpose. Length should not exceed 16KB.
71
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
72
+ # will be added to the HTTP request.
73
+ #
74
+ #
75
+ def take(type, object_id, apply_scope, user_data:nil, custom_headers:nil)
76
+ response = take_async(type, object_id, apply_scope, user_data:user_data, custom_headers:custom_headers).value!
77
+ nil
78
+ end
79
+
80
+ #
81
+ # Submit an operation to take a snapshot of face list, large face list, person
82
+ # group or large person group, with user-specified snapshot type, source object
83
+ # id, apply scope and an optional user data.<br />
84
+ # The snapshot interfaces are for users to backup and restore their face data
85
+ # from one face subscription to another, inside same region or across regions.
86
+ # The workflow contains two phases, user first calls Snapshot - Take to create
87
+ # a copy of the source object and store it as a snapshot, then calls Snapshot -
88
+ # Apply to paste the snapshot to target subscription. The snapshots are stored
89
+ # in a centralized location (per Azure instance), so that they can be applied
90
+ # cross accounts and regions.<br />
91
+ # Taking snapshot is an asynchronous operation. An operation id can be obtained
92
+ # from the "Operation-Location" field in response header, to be used in
93
+ # OperationStatus - Get for tracking the progress of creating the snapshot. The
94
+ # snapshot id will be included in the "resourceLocation" field in
95
+ # OperationStatus - Get response when the operation status is "succeeded".<br
96
+ # />
97
+ # Snapshot taking time depends on the number of person and face entries in the
98
+ # source object. It could be in seconds, or up to several hours for 1,000,000
99
+ # persons with multiple faces.<br />
100
+ # Snapshots will be automatically expired and cleaned in 48 hours after it is
101
+ # created by Snapshot - Take. User can delete the snapshot using Snapshot -
102
+ # Delete by themselves any time before expiration.<br />
103
+ # Taking snapshot for a certain object will not block any other operations
104
+ # against the object. All read-only operations (Get/List and
105
+ # Identify/FindSimilar/Verify) can be conducted as usual. For all writable
106
+ # operations, including Add/Update/Delete the source object or its
107
+ # persons/faces and Train, they are not blocked but not recommended because
108
+ # writable updates may not be reflected on the snapshot during its taking.
109
+ # After snapshot taking is completed, all readable and writable operations can
110
+ # work as normal. Snapshot will also include the training results of the source
111
+ # object, which means target subscription the snapshot applied to does not need
112
+ # re-train the target object before calling Identify/FindSimilar.<br />
113
+ # * Free-tier subscription quota: 100 take operations per month.
114
+ # * S0-tier subscription quota: 100 take operations per day.
115
+ #
116
+ # @param type [SnapshotObjectType] User specified type for the source object to
117
+ # take snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
118
+ # LargePersonGroup are supported. Possible values include: 'FaceList',
119
+ # 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
120
+ # @param object_id [String] User specified source object id to take snapshot
121
+ # from.
122
+ # @param apply_scope User specified array of target Face subscription ids for
123
+ # the snapshot. For each snapshot, only subscriptions included in the
124
+ # applyScope of Snapshot - Take can apply it.
125
+ # @param user_data [String] User specified data about the snapshot for any
126
+ # purpose. Length should not exceed 16KB.
127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
128
+ # will be added to the HTTP request.
129
+ #
130
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
131
+ #
132
+ def take_with_http_info(type, object_id, apply_scope, user_data:nil, custom_headers:nil)
133
+ take_async(type, object_id, apply_scope, user_data:user_data, custom_headers:custom_headers).value!
134
+ end
135
+
136
+ #
137
+ # Submit an operation to take a snapshot of face list, large face list, person
138
+ # group or large person group, with user-specified snapshot type, source object
139
+ # id, apply scope and an optional user data.<br />
140
+ # The snapshot interfaces are for users to backup and restore their face data
141
+ # from one face subscription to another, inside same region or across regions.
142
+ # The workflow contains two phases, user first calls Snapshot - Take to create
143
+ # a copy of the source object and store it as a snapshot, then calls Snapshot -
144
+ # Apply to paste the snapshot to target subscription. The snapshots are stored
145
+ # in a centralized location (per Azure instance), so that they can be applied
146
+ # cross accounts and regions.<br />
147
+ # Taking snapshot is an asynchronous operation. An operation id can be obtained
148
+ # from the "Operation-Location" field in response header, to be used in
149
+ # OperationStatus - Get for tracking the progress of creating the snapshot. The
150
+ # snapshot id will be included in the "resourceLocation" field in
151
+ # OperationStatus - Get response when the operation status is "succeeded".<br
152
+ # />
153
+ # Snapshot taking time depends on the number of person and face entries in the
154
+ # source object. It could be in seconds, or up to several hours for 1,000,000
155
+ # persons with multiple faces.<br />
156
+ # Snapshots will be automatically expired and cleaned in 48 hours after it is
157
+ # created by Snapshot - Take. User can delete the snapshot using Snapshot -
158
+ # Delete by themselves any time before expiration.<br />
159
+ # Taking snapshot for a certain object will not block any other operations
160
+ # against the object. All read-only operations (Get/List and
161
+ # Identify/FindSimilar/Verify) can be conducted as usual. For all writable
162
+ # operations, including Add/Update/Delete the source object or its
163
+ # persons/faces and Train, they are not blocked but not recommended because
164
+ # writable updates may not be reflected on the snapshot during its taking.
165
+ # After snapshot taking is completed, all readable and writable operations can
166
+ # work as normal. Snapshot will also include the training results of the source
167
+ # object, which means target subscription the snapshot applied to does not need
168
+ # re-train the target object before calling Identify/FindSimilar.<br />
169
+ # * Free-tier subscription quota: 100 take operations per month.
170
+ # * S0-tier subscription quota: 100 take operations per day.
171
+ #
172
+ # @param type [SnapshotObjectType] User specified type for the source object to
173
+ # take snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
174
+ # LargePersonGroup are supported. Possible values include: 'FaceList',
175
+ # 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
176
+ # @param object_id [String] User specified source object id to take snapshot
177
+ # from.
178
+ # @param apply_scope User specified array of target Face subscription ids for
179
+ # the snapshot. For each snapshot, only subscriptions included in the
180
+ # applyScope of Snapshot - Take can apply it.
181
+ # @param user_data [String] User specified data about the snapshot for any
182
+ # purpose. Length should not exceed 16KB.
183
+ # @param [Hash{String => String}] A hash of custom headers that will be added
184
+ # to the HTTP request.
185
+ #
186
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
187
+ #
188
+ def take_async(type, object_id, apply_scope, user_data:nil, custom_headers:nil)
189
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
190
+ fail ArgumentError, 'type is nil' if type.nil?
191
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
192
+ fail ArgumentError, "'object_id' should satisfy the constraint - 'MaxLength': '64'" if !object_id.nil? && object_id.length > 64
193
+ fail ArgumentError, "'object_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !object_id.nil? && object_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
194
+ fail ArgumentError, 'apply_scope is nil' if apply_scope.nil?
195
+ fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
196
+
197
+ body = TakeSnapshotRequest.new
198
+ unless type.nil? && object_id.nil? && apply_scope.nil? && user_data.nil?
199
+ body.type = type
200
+ body.object_id = object_id
201
+ body.apply_scope = apply_scope
202
+ body.user_data = user_data
203
+ end
204
+
205
+ request_headers = {}
206
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
207
+
208
+ # Set Headers
209
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
210
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
211
+
212
+ # Serialize Request
213
+ request_mapper = Azure::CognitiveServices::Face::V1_0::Models::TakeSnapshotRequest.mapper()
214
+ request_content = @client.serialize(request_mapper, body)
215
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
216
+
217
+ path_template = 'snapshots'
218
+
219
+ request_url = @base_url || @client.base_url
220
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
221
+
222
+ options = {
223
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
224
+ body: request_content,
225
+ headers: request_headers.merge(custom_headers || {}),
226
+ base_url: request_url
227
+ }
228
+ promise = @client.make_request_async(:post, path_template, options)
229
+
230
+ promise = promise.then do |result|
231
+ http_response = result.response
232
+ status_code = http_response.status
233
+ response_content = http_response.body
234
+ unless status_code == 202
235
+ error_model = JSON.load(response_content)
236
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
237
+ end
238
+
239
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
240
+
241
+ result
242
+ end
243
+
244
+ promise.execute
245
+ end
246
+
247
+ #
248
+ # List all accessible snapshots with related information, including snapshots
249
+ # that were taken by the user, or snapshots to be applied to the user
250
+ # (subscription id was included in the applyScope in Snapshot - Take).
251
+ #
252
+ # @param type [SnapshotObjectType] User specified object type as a search
253
+ # filter. Possible values include: 'FaceList', 'LargeFaceList',
254
+ # 'LargePersonGroup', 'PersonGroup'
255
+ # @param apply_scope User specified snapshot apply scopes as a search filter.
256
+ # ApplyScope is an array of the target Azure subscription ids for the snapshot,
257
+ # specified by the user who created the snapshot by Snapshot - Take.
258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
259
+ # will be added to the HTTP request.
260
+ #
261
+ # @return [Array] operation results.
262
+ #
263
+ def list(type:nil, apply_scope:nil, custom_headers:nil)
264
+ response = list_async(type:type, apply_scope:apply_scope, custom_headers:custom_headers).value!
265
+ response.body unless response.nil?
266
+ end
267
+
268
+ #
269
+ # List all accessible snapshots with related information, including snapshots
270
+ # that were taken by the user, or snapshots to be applied to the user
271
+ # (subscription id was included in the applyScope in Snapshot - Take).
272
+ #
273
+ # @param type [SnapshotObjectType] User specified object type as a search
274
+ # filter. Possible values include: 'FaceList', 'LargeFaceList',
275
+ # 'LargePersonGroup', 'PersonGroup'
276
+ # @param apply_scope User specified snapshot apply scopes as a search filter.
277
+ # ApplyScope is an array of the target Azure subscription ids for the snapshot,
278
+ # specified by the user who created the snapshot by Snapshot - Take.
279
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
280
+ # will be added to the HTTP request.
281
+ #
282
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
283
+ #
284
+ def list_with_http_info(type:nil, apply_scope:nil, custom_headers:nil)
285
+ list_async(type:type, apply_scope:apply_scope, custom_headers:custom_headers).value!
286
+ end
287
+
288
+ #
289
+ # List all accessible snapshots with related information, including snapshots
290
+ # that were taken by the user, or snapshots to be applied to the user
291
+ # (subscription id was included in the applyScope in Snapshot - Take).
292
+ #
293
+ # @param type [SnapshotObjectType] User specified object type as a search
294
+ # filter. Possible values include: 'FaceList', 'LargeFaceList',
295
+ # 'LargePersonGroup', 'PersonGroup'
296
+ # @param apply_scope User specified snapshot apply scopes as a search filter.
297
+ # ApplyScope is an array of the target Azure subscription ids for the snapshot,
298
+ # specified by the user who created the snapshot by Snapshot - Take.
299
+ # @param [Hash{String => String}] A hash of custom headers that will be added
300
+ # to the HTTP request.
301
+ #
302
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
303
+ #
304
+ def list_async(type:nil, apply_scope:nil, custom_headers:nil)
305
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
306
+
307
+
308
+ request_headers = {}
309
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
310
+
311
+ # Set Headers
312
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
313
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
314
+ path_template = 'snapshots'
315
+
316
+ request_url = @base_url || @client.base_url
317
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
318
+
319
+ options = {
320
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
321
+ query_params: {'type' => type,'applyScope' => apply_scope.nil? ? nil : apply_scope.join(',')},
322
+ headers: request_headers.merge(custom_headers || {}),
323
+ base_url: request_url
324
+ }
325
+ promise = @client.make_request_async(:get, path_template, options)
326
+
327
+ promise = promise.then do |result|
328
+ http_response = result.response
329
+ status_code = http_response.status
330
+ response_content = http_response.body
331
+ unless status_code == 200
332
+ error_model = JSON.load(response_content)
333
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
334
+ end
335
+
336
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
337
+ # Deserialize Response
338
+ if status_code == 200
339
+ begin
340
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
341
+ result_mapper = {
342
+ client_side_validation: true,
343
+ required: false,
344
+ serialized_name: 'parsed_response',
345
+ type: {
346
+ name: 'Sequence',
347
+ element: {
348
+ client_side_validation: true,
349
+ required: false,
350
+ serialized_name: 'SnapshotElementType',
351
+ type: {
352
+ name: 'Composite',
353
+ class_name: 'Snapshot'
354
+ }
355
+ }
356
+ }
357
+ }
358
+ result.body = @client.deserialize(result_mapper, parsed_response)
359
+ rescue Exception => e
360
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
361
+ end
362
+ end
363
+
364
+ result
365
+ end
366
+
367
+ promise.execute
368
+ end
369
+
370
+ #
371
+ # Retrieve information about a snapshot. Snapshot is only accessible to the
372
+ # source subscription who took it, and target subscriptions included in the
373
+ # applyScope in Snapshot - Take.
374
+ #
375
+ # @param snapshot_id Id referencing a particular snapshot.
376
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
377
+ # will be added to the HTTP request.
378
+ #
379
+ # @return [Snapshot] operation results.
380
+ #
381
+ def get(snapshot_id, custom_headers:nil)
382
+ response = get_async(snapshot_id, custom_headers:custom_headers).value!
383
+ response.body unless response.nil?
384
+ end
385
+
386
+ #
387
+ # Retrieve information about a snapshot. Snapshot is only accessible to the
388
+ # source subscription who took it, and target subscriptions included in the
389
+ # applyScope in Snapshot - Take.
390
+ #
391
+ # @param snapshot_id Id referencing a particular snapshot.
392
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
393
+ # will be added to the HTTP request.
394
+ #
395
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
396
+ #
397
+ def get_with_http_info(snapshot_id, custom_headers:nil)
398
+ get_async(snapshot_id, custom_headers:custom_headers).value!
399
+ end
400
+
401
+ #
402
+ # Retrieve information about a snapshot. Snapshot is only accessible to the
403
+ # source subscription who took it, and target subscriptions included in the
404
+ # applyScope in Snapshot - Take.
405
+ #
406
+ # @param snapshot_id Id referencing a particular snapshot.
407
+ # @param [Hash{String => String}] A hash of custom headers that will be added
408
+ # to the HTTP request.
409
+ #
410
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
411
+ #
412
+ def get_async(snapshot_id, custom_headers:nil)
413
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
414
+ fail ArgumentError, 'snapshot_id is nil' if snapshot_id.nil?
415
+
416
+
417
+ request_headers = {}
418
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
419
+
420
+ # Set Headers
421
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
422
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
423
+ path_template = 'snapshots/{snapshotId}'
424
+
425
+ request_url = @base_url || @client.base_url
426
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
427
+
428
+ options = {
429
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
430
+ path_params: {'snapshotId' => snapshot_id},
431
+ headers: request_headers.merge(custom_headers || {}),
432
+ base_url: request_url
433
+ }
434
+ promise = @client.make_request_async(:get, path_template, options)
435
+
436
+ promise = promise.then do |result|
437
+ http_response = result.response
438
+ status_code = http_response.status
439
+ response_content = http_response.body
440
+ unless status_code == 200
441
+ error_model = JSON.load(response_content)
442
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
443
+ end
444
+
445
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
446
+ # Deserialize Response
447
+ if status_code == 200
448
+ begin
449
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
450
+ result_mapper = Azure::CognitiveServices::Face::V1_0::Models::Snapshot.mapper()
451
+ result.body = @client.deserialize(result_mapper, parsed_response)
452
+ rescue Exception => e
453
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
454
+ end
455
+ end
456
+
457
+ result
458
+ end
459
+
460
+ promise.execute
461
+ end
462
+
463
+ #
464
+ # Update the information of a snapshot. Only the source subscription who took
465
+ # the snapshot can update the snapshot.
466
+ #
467
+ # @param snapshot_id Id referencing a particular snapshot.
468
+ # @param apply_scope Array of the target Face subscription ids for the
469
+ # snapshot, specified by the user who created the snapshot when calling
470
+ # Snapshot - Take. For each snapshot, only subscriptions included in the
471
+ # applyScope of Snapshot - Take can apply it.
472
+ # @param user_data [String] User specified data about the snapshot for any
473
+ # purpose. Length should not exceed 16KB.
474
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
475
+ # will be added to the HTTP request.
476
+ #
477
+ #
478
+ def update(snapshot_id, apply_scope:nil, user_data:nil, custom_headers:nil)
479
+ response = update_async(snapshot_id, apply_scope:apply_scope, user_data:user_data, custom_headers:custom_headers).value!
480
+ nil
481
+ end
482
+
483
+ #
484
+ # Update the information of a snapshot. Only the source subscription who took
485
+ # the snapshot can update the snapshot.
486
+ #
487
+ # @param snapshot_id Id referencing a particular snapshot.
488
+ # @param apply_scope Array of the target Face subscription ids for the
489
+ # snapshot, specified by the user who created the snapshot when calling
490
+ # Snapshot - Take. For each snapshot, only subscriptions included in the
491
+ # applyScope of Snapshot - Take can apply it.
492
+ # @param user_data [String] User specified data about the snapshot for any
493
+ # purpose. Length should not exceed 16KB.
494
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
495
+ # will be added to the HTTP request.
496
+ #
497
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
498
+ #
499
+ def update_with_http_info(snapshot_id, apply_scope:nil, user_data:nil, custom_headers:nil)
500
+ update_async(snapshot_id, apply_scope:apply_scope, user_data:user_data, custom_headers:custom_headers).value!
501
+ end
502
+
503
+ #
504
+ # Update the information of a snapshot. Only the source subscription who took
505
+ # the snapshot can update the snapshot.
506
+ #
507
+ # @param snapshot_id Id referencing a particular snapshot.
508
+ # @param apply_scope Array of the target Face subscription ids for the
509
+ # snapshot, specified by the user who created the snapshot when calling
510
+ # Snapshot - Take. For each snapshot, only subscriptions included in the
511
+ # applyScope of Snapshot - Take can apply it.
512
+ # @param user_data [String] User specified data about the snapshot for any
513
+ # purpose. Length should not exceed 16KB.
514
+ # @param [Hash{String => String}] A hash of custom headers that will be added
515
+ # to the HTTP request.
516
+ #
517
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
518
+ #
519
+ def update_async(snapshot_id, apply_scope:nil, user_data:nil, custom_headers:nil)
520
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
521
+ fail ArgumentError, 'snapshot_id is nil' if snapshot_id.nil?
522
+ fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
523
+
524
+ body = UpdateSnapshotRequest.new
525
+ unless apply_scope.nil? && user_data.nil?
526
+ body.apply_scope = apply_scope
527
+ body.user_data = user_data
528
+ end
529
+
530
+ request_headers = {}
531
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
532
+
533
+ # Set Headers
534
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
535
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
536
+
537
+ # Serialize Request
538
+ request_mapper = Azure::CognitiveServices::Face::V1_0::Models::UpdateSnapshotRequest.mapper()
539
+ request_content = @client.serialize(request_mapper, body)
540
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
541
+
542
+ path_template = 'snapshots/{snapshotId}'
543
+
544
+ request_url = @base_url || @client.base_url
545
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
546
+
547
+ options = {
548
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
549
+ path_params: {'snapshotId' => snapshot_id},
550
+ body: request_content,
551
+ headers: request_headers.merge(custom_headers || {}),
552
+ base_url: request_url
553
+ }
554
+ promise = @client.make_request_async(:patch, path_template, options)
555
+
556
+ promise = promise.then do |result|
557
+ http_response = result.response
558
+ status_code = http_response.status
559
+ response_content = http_response.body
560
+ unless status_code == 200
561
+ error_model = JSON.load(response_content)
562
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
563
+ end
564
+
565
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
566
+
567
+ result
568
+ end
569
+
570
+ promise.execute
571
+ end
572
+
573
+ #
574
+ # Delete an existing snapshot according to the snapshotId. All object data and
575
+ # information in the snapshot will also be deleted. Only the source
576
+ # subscription who took the snapshot can delete the snapshot. If the user does
577
+ # not delete a snapshot with this API, the snapshot will still be automatically
578
+ # deleted in 48 hours after creation.
579
+ #
580
+ # @param snapshot_id Id referencing a particular snapshot.
581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
582
+ # will be added to the HTTP request.
583
+ #
584
+ #
585
+ def delete(snapshot_id, custom_headers:nil)
586
+ response = delete_async(snapshot_id, custom_headers:custom_headers).value!
587
+ nil
588
+ end
589
+
590
+ #
591
+ # Delete an existing snapshot according to the snapshotId. All object data and
592
+ # information in the snapshot will also be deleted. Only the source
593
+ # subscription who took the snapshot can delete the snapshot. If the user does
594
+ # not delete a snapshot with this API, the snapshot will still be automatically
595
+ # deleted in 48 hours after creation.
596
+ #
597
+ # @param snapshot_id Id referencing a particular snapshot.
598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
599
+ # will be added to the HTTP request.
600
+ #
601
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
602
+ #
603
+ def delete_with_http_info(snapshot_id, custom_headers:nil)
604
+ delete_async(snapshot_id, custom_headers:custom_headers).value!
605
+ end
606
+
607
+ #
608
+ # Delete an existing snapshot according to the snapshotId. All object data and
609
+ # information in the snapshot will also be deleted. Only the source
610
+ # subscription who took the snapshot can delete the snapshot. If the user does
611
+ # not delete a snapshot with this API, the snapshot will still be automatically
612
+ # deleted in 48 hours after creation.
613
+ #
614
+ # @param snapshot_id Id referencing a particular snapshot.
615
+ # @param [Hash{String => String}] A hash of custom headers that will be added
616
+ # to the HTTP request.
617
+ #
618
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
619
+ #
620
+ def delete_async(snapshot_id, custom_headers:nil)
621
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
622
+ fail ArgumentError, 'snapshot_id is nil' if snapshot_id.nil?
623
+
624
+
625
+ request_headers = {}
626
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
627
+
628
+ # Set Headers
629
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
630
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
631
+ path_template = 'snapshots/{snapshotId}'
632
+
633
+ request_url = @base_url || @client.base_url
634
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
635
+
636
+ options = {
637
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
638
+ path_params: {'snapshotId' => snapshot_id},
639
+ headers: request_headers.merge(custom_headers || {}),
640
+ base_url: request_url
641
+ }
642
+ promise = @client.make_request_async(:delete, path_template, options)
643
+
644
+ promise = promise.then do |result|
645
+ http_response = result.response
646
+ status_code = http_response.status
647
+ response_content = http_response.body
648
+ unless status_code == 200
649
+ error_model = JSON.load(response_content)
650
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
651
+ end
652
+
653
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
654
+
655
+ result
656
+ end
657
+
658
+ promise.execute
659
+ end
660
+
661
+ #
662
+ # Submit an operation to apply a snapshot to current subscription. For each
663
+ # snapshot, only subscriptions included in the applyScope of Snapshot - Take
664
+ # can apply it.<br />
665
+ # The snapshot interfaces are for users to backup and restore their face data
666
+ # from one face subscription to another, inside same region or across regions.
667
+ # The workflow contains two phases, user first calls Snapshot - Take to create
668
+ # a copy of the source object and store it as a snapshot, then calls Snapshot -
669
+ # Apply to paste the snapshot to target subscription. The snapshots are stored
670
+ # in a centralized location (per Azure instance), so that they can be applied
671
+ # cross accounts and regions.<br />
672
+ # Applying snapshot is an asynchronous operation. An operation id can be
673
+ # obtained from the "Operation-Location" field in response header, to be used
674
+ # in OperationStatus - Get for tracking the progress of applying the snapshot.
675
+ # The target object id will be included in the "resourceLocation" field in
676
+ # OperationStatus - Get response when the operation status is "succeeded".<br
677
+ # />
678
+ # Snapshot applying time depends on the number of person and face entries in
679
+ # the snapshot object. It could be in seconds, or up to 1 hour for 1,000,000
680
+ # persons with multiple faces.<br />
681
+ # Snapshots will be automatically expired and cleaned in 48 hours after it is
682
+ # created by Snapshot - Take. So the target subscription is required to apply
683
+ # the snapshot in 48 hours since its creation.<br />
684
+ # Applying a snapshot will not block any other operations against the target
685
+ # object, however it is not recommended because the correctness cannot be
686
+ # guaranteed during snapshot applying. After snapshot applying is completed,
687
+ # all operations towards the target object can work as normal. Snapshot also
688
+ # includes the training results of the source object, which means target
689
+ # subscription the snapshot applied to does not need re-train the target object
690
+ # before calling Identify/FindSimilar.<br />
691
+ # One snapshot can be applied multiple times in parallel, while currently only
692
+ # CreateNew apply mode is supported, which means the apply operation will fail
693
+ # if target subscription already contains an object of same type and using the
694
+ # same objectId. Users can specify the "objectId" in request body to avoid such
695
+ # conflicts.<br />
696
+ # * Free-tier subscription quota: 100 apply operations per month.
697
+ # * S0-tier subscription quota: 100 apply operations per day.
698
+ #
699
+ # @param snapshot_id Id referencing a particular snapshot.
700
+ # @param object_id [String] User specified target object id to be created from
701
+ # the snapshot.
702
+ # @param mode [SnapshotApplyMode] Snapshot applying mode. Currently only
703
+ # CreateNew is supported, which means the apply operation will fail if target
704
+ # subscription already contains an object of same type and using the same
705
+ # objectId. Users can specify the "objectId" in request body to avoid such
706
+ # conflicts. Possible values include: 'CreateNew'
707
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
708
+ # will be added to the HTTP request.
709
+ #
710
+ #
711
+ def apply(snapshot_id, object_id, mode:nil, custom_headers:nil)
712
+ response = apply_async(snapshot_id, object_id, mode:mode, custom_headers:custom_headers).value!
713
+ nil
714
+ end
715
+
716
+ #
717
+ # Submit an operation to apply a snapshot to current subscription. For each
718
+ # snapshot, only subscriptions included in the applyScope of Snapshot - Take
719
+ # can apply it.<br />
720
+ # The snapshot interfaces are for users to backup and restore their face data
721
+ # from one face subscription to another, inside same region or across regions.
722
+ # The workflow contains two phases, user first calls Snapshot - Take to create
723
+ # a copy of the source object and store it as a snapshot, then calls Snapshot -
724
+ # Apply to paste the snapshot to target subscription. The snapshots are stored
725
+ # in a centralized location (per Azure instance), so that they can be applied
726
+ # cross accounts and regions.<br />
727
+ # Applying snapshot is an asynchronous operation. An operation id can be
728
+ # obtained from the "Operation-Location" field in response header, to be used
729
+ # in OperationStatus - Get for tracking the progress of applying the snapshot.
730
+ # The target object id will be included in the "resourceLocation" field in
731
+ # OperationStatus - Get response when the operation status is "succeeded".<br
732
+ # />
733
+ # Snapshot applying time depends on the number of person and face entries in
734
+ # the snapshot object. It could be in seconds, or up to 1 hour for 1,000,000
735
+ # persons with multiple faces.<br />
736
+ # Snapshots will be automatically expired and cleaned in 48 hours after it is
737
+ # created by Snapshot - Take. So the target subscription is required to apply
738
+ # the snapshot in 48 hours since its creation.<br />
739
+ # Applying a snapshot will not block any other operations against the target
740
+ # object, however it is not recommended because the correctness cannot be
741
+ # guaranteed during snapshot applying. After snapshot applying is completed,
742
+ # all operations towards the target object can work as normal. Snapshot also
743
+ # includes the training results of the source object, which means target
744
+ # subscription the snapshot applied to does not need re-train the target object
745
+ # before calling Identify/FindSimilar.<br />
746
+ # One snapshot can be applied multiple times in parallel, while currently only
747
+ # CreateNew apply mode is supported, which means the apply operation will fail
748
+ # if target subscription already contains an object of same type and using the
749
+ # same objectId. Users can specify the "objectId" in request body to avoid such
750
+ # conflicts.<br />
751
+ # * Free-tier subscription quota: 100 apply operations per month.
752
+ # * S0-tier subscription quota: 100 apply operations per day.
753
+ #
754
+ # @param snapshot_id Id referencing a particular snapshot.
755
+ # @param object_id [String] User specified target object id to be created from
756
+ # the snapshot.
757
+ # @param mode [SnapshotApplyMode] Snapshot applying mode. Currently only
758
+ # CreateNew is supported, which means the apply operation will fail if target
759
+ # subscription already contains an object of same type and using the same
760
+ # objectId. Users can specify the "objectId" in request body to avoid such
761
+ # conflicts. Possible values include: 'CreateNew'
762
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
763
+ # will be added to the HTTP request.
764
+ #
765
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
766
+ #
767
+ def apply_with_http_info(snapshot_id, object_id, mode:nil, custom_headers:nil)
768
+ apply_async(snapshot_id, object_id, mode:mode, custom_headers:custom_headers).value!
769
+ end
770
+
771
+ #
772
+ # Submit an operation to apply a snapshot to current subscription. For each
773
+ # snapshot, only subscriptions included in the applyScope of Snapshot - Take
774
+ # can apply it.<br />
775
+ # The snapshot interfaces are for users to backup and restore their face data
776
+ # from one face subscription to another, inside same region or across regions.
777
+ # The workflow contains two phases, user first calls Snapshot - Take to create
778
+ # a copy of the source object and store it as a snapshot, then calls Snapshot -
779
+ # Apply to paste the snapshot to target subscription. The snapshots are stored
780
+ # in a centralized location (per Azure instance), so that they can be applied
781
+ # cross accounts and regions.<br />
782
+ # Applying snapshot is an asynchronous operation. An operation id can be
783
+ # obtained from the "Operation-Location" field in response header, to be used
784
+ # in OperationStatus - Get for tracking the progress of applying the snapshot.
785
+ # The target object id will be included in the "resourceLocation" field in
786
+ # OperationStatus - Get response when the operation status is "succeeded".<br
787
+ # />
788
+ # Snapshot applying time depends on the number of person and face entries in
789
+ # the snapshot object. It could be in seconds, or up to 1 hour for 1,000,000
790
+ # persons with multiple faces.<br />
791
+ # Snapshots will be automatically expired and cleaned in 48 hours after it is
792
+ # created by Snapshot - Take. So the target subscription is required to apply
793
+ # the snapshot in 48 hours since its creation.<br />
794
+ # Applying a snapshot will not block any other operations against the target
795
+ # object, however it is not recommended because the correctness cannot be
796
+ # guaranteed during snapshot applying. After snapshot applying is completed,
797
+ # all operations towards the target object can work as normal. Snapshot also
798
+ # includes the training results of the source object, which means target
799
+ # subscription the snapshot applied to does not need re-train the target object
800
+ # before calling Identify/FindSimilar.<br />
801
+ # One snapshot can be applied multiple times in parallel, while currently only
802
+ # CreateNew apply mode is supported, which means the apply operation will fail
803
+ # if target subscription already contains an object of same type and using the
804
+ # same objectId. Users can specify the "objectId" in request body to avoid such
805
+ # conflicts.<br />
806
+ # * Free-tier subscription quota: 100 apply operations per month.
807
+ # * S0-tier subscription quota: 100 apply operations per day.
808
+ #
809
+ # @param snapshot_id Id referencing a particular snapshot.
810
+ # @param object_id [String] User specified target object id to be created from
811
+ # the snapshot.
812
+ # @param mode [SnapshotApplyMode] Snapshot applying mode. Currently only
813
+ # CreateNew is supported, which means the apply operation will fail if target
814
+ # subscription already contains an object of same type and using the same
815
+ # objectId. Users can specify the "objectId" in request body to avoid such
816
+ # conflicts. Possible values include: 'CreateNew'
817
+ # @param [Hash{String => String}] A hash of custom headers that will be added
818
+ # to the HTTP request.
819
+ #
820
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
821
+ #
822
+ def apply_async(snapshot_id, object_id, mode:nil, custom_headers:nil)
823
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
824
+ fail ArgumentError, 'snapshot_id is nil' if snapshot_id.nil?
825
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
826
+ fail ArgumentError, "'object_id' should satisfy the constraint - 'MaxLength': '64'" if !object_id.nil? && object_id.length > 64
827
+ fail ArgumentError, "'object_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !object_id.nil? && object_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
828
+
829
+ body = ApplySnapshotRequest.new
830
+ unless object_id.nil? && mode.nil?
831
+ body.object_id = object_id
832
+ body.mode = mode
833
+ end
834
+
835
+ request_headers = {}
836
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
837
+
838
+ # Set Headers
839
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
840
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
841
+
842
+ # Serialize Request
843
+ request_mapper = Azure::CognitiveServices::Face::V1_0::Models::ApplySnapshotRequest.mapper()
844
+ request_content = @client.serialize(request_mapper, body)
845
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
846
+
847
+ path_template = 'snapshots/{snapshotId}/apply'
848
+
849
+ request_url = @base_url || @client.base_url
850
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
851
+
852
+ options = {
853
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
854
+ path_params: {'snapshotId' => snapshot_id},
855
+ body: request_content,
856
+ headers: request_headers.merge(custom_headers || {}),
857
+ base_url: request_url
858
+ }
859
+ promise = @client.make_request_async(:post, path_template, options)
860
+
861
+ promise = promise.then do |result|
862
+ http_response = result.response
863
+ status_code = http_response.status
864
+ response_content = http_response.body
865
+ unless status_code == 202
866
+ error_model = JSON.load(response_content)
867
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
868
+ end
869
+
870
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
871
+
872
+ result
873
+ end
874
+
875
+ promise.execute
876
+ end
877
+
878
+ #
879
+ # Retrieve the status of a take/apply snapshot operation.
880
+ #
881
+ # @param operation_id Id referencing a particular take/apply snapshot
882
+ # operation.
883
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
884
+ # will be added to the HTTP request.
885
+ #
886
+ # @return [OperationStatus] operation results.
887
+ #
888
+ def get_operation_status(operation_id, custom_headers:nil)
889
+ response = get_operation_status_async(operation_id, custom_headers:custom_headers).value!
890
+ response.body unless response.nil?
891
+ end
892
+
893
+ #
894
+ # Retrieve the status of a take/apply snapshot operation.
895
+ #
896
+ # @param operation_id Id referencing a particular take/apply snapshot
897
+ # operation.
898
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
899
+ # will be added to the HTTP request.
900
+ #
901
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
902
+ #
903
+ def get_operation_status_with_http_info(operation_id, custom_headers:nil)
904
+ get_operation_status_async(operation_id, custom_headers:custom_headers).value!
905
+ end
906
+
907
+ #
908
+ # Retrieve the status of a take/apply snapshot operation.
909
+ #
910
+ # @param operation_id Id referencing a particular take/apply snapshot
911
+ # operation.
912
+ # @param [Hash{String => String}] A hash of custom headers that will be added
913
+ # to the HTTP request.
914
+ #
915
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
916
+ #
917
+ def get_operation_status_async(operation_id, custom_headers:nil)
918
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
919
+ fail ArgumentError, 'operation_id is nil' if operation_id.nil?
920
+
921
+
922
+ request_headers = {}
923
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
924
+
925
+ # Set Headers
926
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
927
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
928
+ path_template = 'operations/{operationId}'
929
+
930
+ request_url = @base_url || @client.base_url
931
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
932
+
933
+ options = {
934
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
935
+ path_params: {'operationId' => operation_id},
936
+ headers: request_headers.merge(custom_headers || {}),
937
+ base_url: request_url
938
+ }
939
+ promise = @client.make_request_async(:get, path_template, options)
940
+
941
+ promise = promise.then do |result|
942
+ http_response = result.response
943
+ status_code = http_response.status
944
+ response_content = http_response.body
945
+ unless status_code == 200
946
+ error_model = JSON.load(response_content)
947
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
948
+ end
949
+
950
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
951
+ # Deserialize Response
952
+ if status_code == 200
953
+ begin
954
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
955
+ result_mapper = Azure::CognitiveServices::Face::V1_0::Models::OperationStatus.mapper()
956
+ result.body = @client.deserialize(result_mapper, parsed_response)
957
+ rescue Exception => e
958
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
959
+ end
960
+ end
961
+
962
+ result
963
+ end
964
+
965
+ promise.execute
966
+ end
967
+
968
+ end
969
+ end