azure_cognitiveservices_customvisiontraining 0.17.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 (153) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining.rb +71 -0
  4. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb +4359 -0
  5. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/bounding_box.rb +80 -0
  6. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/domain.rb +97 -0
  7. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/domain_type.rb +16 -0
  8. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/export.rb +86 -0
  9. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/export_flavor.rb +16 -0
  10. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/export_platform.rb +18 -0
  11. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/export_status_model.rb +17 -0
  12. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image.rb +149 -0
  13. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_create_result.rb +76 -0
  14. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_create_summary.rb +69 -0
  15. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_file_create_batch.rb +75 -0
  16. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_file_create_entry.rb +97 -0
  17. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_id_create_batch.rb +75 -0
  18. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_id_create_entry.rb +86 -0
  19. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_performance.rb +170 -0
  20. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_prediction.rb +105 -0
  21. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region.rb +127 -0
  22. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_batch.rb +55 -0
  23. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_entry.rb +102 -0
  24. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_result.rb +139 -0
  25. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_summary.rb +96 -0
  26. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_proposal.rb +81 -0
  27. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_tag.rb +72 -0
  28. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_batch.rb +56 -0
  29. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_entry.rb +58 -0
  30. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_summary.rb +96 -0
  31. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_upload_status.rb +24 -0
  32. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_url.rb +47 -0
  33. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_url_create_batch.rb +75 -0
  34. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_url_create_entry.rb +86 -0
  35. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/iteration.rb +156 -0
  36. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/iteration_performance.rb +117 -0
  37. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/order_by.rb +17 -0
  38. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/prediction.rb +85 -0
  39. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_result.rb +70 -0
  40. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_tag.rb +72 -0
  41. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_token.rb +145 -0
  42. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/project.rb +117 -0
  43. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/project_settings.rb +46 -0
  44. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/region.rb +91 -0
  45. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/region_proposal.rb +61 -0
  46. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/stored_image_prediction.rb +140 -0
  47. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/tag.rb +81 -0
  48. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/models/tag_performance.rb +119 -0
  49. data/lib/2.0/generated/azure_cognitiveservices_customvisiontraining/module_definition.rb +9 -0
  50. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining.rb +72 -0
  51. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb +4368 -0
  52. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/bounding_box.rb +80 -0
  53. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/classifier.rb +16 -0
  54. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/domain.rb +97 -0
  55. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/domain_type.rb +16 -0
  56. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/export.rb +98 -0
  57. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/export_flavor.rb +16 -0
  58. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/export_platform.rb +18 -0
  59. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/export_status_model.rb +17 -0
  60. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image.rb +149 -0
  61. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_create_result.rb +76 -0
  62. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_create_summary.rb +69 -0
  63. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_file_create_batch.rb +75 -0
  64. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_file_create_entry.rb +97 -0
  65. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_id_create_batch.rb +75 -0
  66. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_id_create_entry.rb +86 -0
  67. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_performance.rb +170 -0
  68. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_prediction.rb +105 -0
  69. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_region.rb +127 -0
  70. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_batch.rb +55 -0
  71. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_entry.rb +102 -0
  72. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_result.rb +139 -0
  73. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_summary.rb +96 -0
  74. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_region_proposal.rb +81 -0
  75. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_tag.rb +72 -0
  76. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_batch.rb +56 -0
  77. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_entry.rb +58 -0
  78. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_summary.rb +96 -0
  79. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_upload_status.rb +24 -0
  80. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_url.rb +47 -0
  81. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_url_create_batch.rb +75 -0
  82. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/image_url_create_entry.rb +86 -0
  83. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/iteration.rb +169 -0
  84. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/iteration_performance.rb +117 -0
  85. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/order_by.rb +17 -0
  86. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/prediction.rb +85 -0
  87. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_result.rb +70 -0
  88. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_tag.rb +72 -0
  89. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_token.rb +145 -0
  90. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/project.rb +117 -0
  91. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/project_settings.rb +58 -0
  92. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/region.rb +91 -0
  93. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/region_proposal.rb +61 -0
  94. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/stored_image_prediction.rb +140 -0
  95. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/tag.rb +81 -0
  96. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/models/tag_performance.rb +119 -0
  97. data/lib/2.1/generated/azure_cognitiveservices_customvisiontraining/module_definition.rb +9 -0
  98. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining.rb +73 -0
  99. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb +4458 -0
  100. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/bounding_box.rb +80 -0
  101. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/classifier.rb +16 -0
  102. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/domain.rb +97 -0
  103. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/domain_type.rb +16 -0
  104. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/export.rb +100 -0
  105. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/export_flavor_model.rb +18 -0
  106. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/export_platform_model.rb +18 -0
  107. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/export_status_model.rb +17 -0
  108. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image.rb +161 -0
  109. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_create_result.rb +77 -0
  110. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_create_status.rb +25 -0
  111. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_create_summary.rb +70 -0
  112. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_file_create_batch.rb +75 -0
  113. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_file_create_entry.rb +97 -0
  114. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_id_create_batch.rb +75 -0
  115. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_id_create_entry.rb +86 -0
  116. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_performance.rb +170 -0
  117. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_prediction.rb +105 -0
  118. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_region.rb +127 -0
  119. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_batch.rb +55 -0
  120. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_entry.rb +101 -0
  121. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_result.rb +139 -0
  122. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_summary.rb +96 -0
  123. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_region_proposal.rb +81 -0
  124. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_tag.rb +72 -0
  125. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_batch.rb +56 -0
  126. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_entry.rb +57 -0
  127. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_summary.rb +96 -0
  128. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_url.rb +47 -0
  129. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_url_create_batch.rb +75 -0
  130. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/image_url_create_entry.rb +86 -0
  131. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/iteration.rb +169 -0
  132. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/iteration_performance.rb +117 -0
  133. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/order_by.rb +17 -0
  134. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/prediction.rb +85 -0
  135. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_result.rb +70 -0
  136. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_tag.rb +72 -0
  137. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_token.rb +145 -0
  138. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/project.rb +117 -0
  139. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/project_settings.rb +58 -0
  140. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/region.rb +91 -0
  141. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/region_proposal.rb +61 -0
  142. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/stored_image_prediction.rb +153 -0
  143. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/tag.rb +93 -0
  144. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/tag_performance.rb +119 -0
  145. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/models/tag_type.rb +16 -0
  146. data/lib/2.2/generated/azure_cognitiveservices_customvisiontraining/module_definition.rb +9 -0
  147. data/lib/azure_cognitiveservices_customvisiontraining.rb +8 -0
  148. data/lib/module_definition.rb +7 -0
  149. data/lib/profiles/latest/customvisiontraining_latest_profile_client.rb +38 -0
  150. data/lib/profiles/latest/customvisiontraining_module_definition.rb +8 -0
  151. data/lib/profiles/latest/modules/customvisiontraining_profile_module.rb +241 -0
  152. data/lib/version.rb +7 -0
  153. metadata +271 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 23716f3b527615407c01c1a08aa8e728a66a92dc
4
+ data.tar.gz: 4e02d1a850472a8832c46974322c0c4821b528ae
5
+ SHA512:
6
+ metadata.gz: 090b21c323a72a18c1d16ba3dd2f5d6b49c9f4ed28a0b64676a4342cb8c51a14195bc6fec5988ba010bb9a5a6252cd458e89b1fde8337f15dd7bc02dc0d93930
7
+ data.tar.gz: a2c6b3c3599e2acdc0cbbccf55ea5a205a9cae6d05caa71b2c449b5bf0972910deb0ed2463c8d7a64e379d26c772b38cc846ea7f7a2442717aa2ca001c4087c2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,71 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2.0/generated/azure_cognitiveservices_customvisiontraining/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::CognitiveServices::Customvisiontraining::V2_0
23
+ autoload :CustomvisiontrainingClient, '2.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb'
24
+
25
+ module Models
26
+ autoload :ImageRegionCreateSummary, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_summary.rb'
27
+ autoload :Domain, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/domain.rb'
28
+ autoload :BoundingBox, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/bounding_box.rb'
29
+ autoload :ImageRegion, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region.rb'
30
+ autoload :RegionProposal, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/region_proposal.rb'
31
+ autoload :ImageCreateResult, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_create_result.rb'
32
+ autoload :ImageRegionProposal, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_proposal.rb'
33
+ autoload :Region, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/region.rb'
34
+ autoload :PredictionQueryTag, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_tag.rb'
35
+ autoload :ImageFileCreateBatch, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_file_create_batch.rb'
36
+ autoload :PredictionQueryToken, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_token.rb'
37
+ autoload :ImageUrlCreateBatch, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_url_create_batch.rb'
38
+ autoload :Prediction, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/prediction.rb'
39
+ autoload :ImageIdCreateBatch, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_id_create_batch.rb'
40
+ autoload :StoredImagePrediction, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/stored_image_prediction.rb'
41
+ autoload :ImageTagCreateBatch, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_batch.rb'
42
+ autoload :PredictionQueryResult, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/prediction_query_result.rb'
43
+ autoload :ImageRegionCreateEntry, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_entry.rb'
44
+ autoload :ImageUrl, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_url.rb'
45
+ autoload :ImageRegionCreateResult, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_result.rb'
46
+ autoload :ImagePrediction, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_prediction.rb'
47
+ autoload :Image, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image.rb'
48
+ autoload :Iteration, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/iteration.rb'
49
+ autoload :ImageFileCreateEntry, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_file_create_entry.rb'
50
+ autoload :ProjectSettings, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/project_settings.rb'
51
+ autoload :ImageIdCreateEntry, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_id_create_entry.rb'
52
+ autoload :Project, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/project.rb'
53
+ autoload :ImageTagCreateSummary, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_summary.rb'
54
+ autoload :TagPerformance, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/tag_performance.rb'
55
+ autoload :ImageTag, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_tag.rb'
56
+ autoload :IterationPerformance, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/iteration_performance.rb'
57
+ autoload :ImageUrlCreateEntry, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_url_create_entry.rb'
58
+ autoload :ImagePerformance, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_performance.rb'
59
+ autoload :ImageRegionCreateBatch, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_region_create_batch.rb'
60
+ autoload :Export, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/export.rb'
61
+ autoload :ImageTagCreateEntry, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_tag_create_entry.rb'
62
+ autoload :Tag, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/tag.rb'
63
+ autoload :ImageCreateSummary, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_create_summary.rb'
64
+ autoload :DomainType, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/domain_type.rb'
65
+ autoload :ImageUploadStatus, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/image_upload_status.rb'
66
+ autoload :OrderBy, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/order_by.rb'
67
+ autoload :ExportPlatform, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/export_platform.rb'
68
+ autoload :ExportStatusModel, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/export_status_model.rb'
69
+ autoload :ExportFlavor, '2.0/generated/azure_cognitiveservices_customvisiontraining/models/export_flavor.rb'
70
+ end
71
+ end
@@ -0,0 +1,4359 @@
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::Customvisiontraining::V2_0
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class CustomvisiontrainingClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String]
21
+ attr_accessor :api_key
22
+
23
+ # @return [String] The preferred language for the response.
24
+ attr_accessor :accept_language
25
+
26
+ # @return [Integer] The retry timeout in seconds for Long Running
27
+ # Operations. Default value is 30.
28
+ attr_accessor :long_running_operation_retry_timeout
29
+
30
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
31
+ # generated. When set to true a unique x-ms-client-request-id value is
32
+ # generated and included in each request. Default is true.
33
+ attr_accessor :generate_client_request_id
34
+
35
+ #
36
+ # Creates initializes a new instance of the CustomvisiontrainingClient class.
37
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
38
+ # @param base_url [String] the base URI of the service.
39
+ # @param options [Array] filters to be applied to the HTTP requests.
40
+ #
41
+ def initialize(credentials = nil, base_url = nil, options = nil)
42
+ super(credentials, options)
43
+ @base_url = base_url || 'https://southcentralus.api.cognitive.microsoft.com/customvision/v2.0/Training'
44
+
45
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
46
+ @credentials = credentials
47
+
48
+ @accept_language = 'en-US'
49
+ @long_running_operation_retry_timeout = 30
50
+ @generate_client_request_id = true
51
+ add_telemetry
52
+ end
53
+
54
+ #
55
+ # Makes a request and returns the body of the response.
56
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
57
+ # @param path [String] the path, relative to {base_url}.
58
+ # @param options [Hash{String=>String}] specifying any request options like :body.
59
+ # @return [Hash{String=>String}] containing the body of the response.
60
+ # Example:
61
+ #
62
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
63
+ # path = "/path"
64
+ # options = {
65
+ # body: request_content,
66
+ # query_params: {'api-version' => '2016-02-01'}
67
+ # }
68
+ # result = @client.make_request(:put, path, options)
69
+ #
70
+ def make_request(method, path, options = {})
71
+ result = make_request_with_http_info(method, path, options)
72
+ result.body unless result.nil?
73
+ end
74
+
75
+ #
76
+ # Makes a request and returns the operation response.
77
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
78
+ # @param path [String] the path, relative to {base_url}.
79
+ # @param options [Hash{String=>String}] specifying any request options like :body.
80
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
81
+ #
82
+ def make_request_with_http_info(method, path, options = {})
83
+ result = make_request_async(method, path, options).value!
84
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
85
+ result
86
+ end
87
+
88
+ #
89
+ # Makes a request asynchronously.
90
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
91
+ # @param path [String] the path, relative to {base_url}.
92
+ # @param options [Hash{String=>String}] specifying any request options like :body.
93
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
94
+ #
95
+ def make_request_async(method, path, options = {})
96
+ fail ArgumentError, 'method is nil' if method.nil?
97
+ fail ArgumentError, 'path is nil' if path.nil?
98
+
99
+ request_url = options[:base_url] || @base_url
100
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
101
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
102
+ end
103
+
104
+ request_headers = @request_headers
105
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
106
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
107
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
108
+
109
+ super(request_url, method, path, options)
110
+ end
111
+
112
+ #
113
+ # Get a list of the available domains
114
+ #
115
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
116
+ # will be added to the HTTP request.
117
+ #
118
+ # @return [Array] operation results.
119
+ #
120
+ def get_domains(custom_headers:nil)
121
+ response = get_domains_async(custom_headers:custom_headers).value!
122
+ response.body unless response.nil?
123
+ end
124
+
125
+ #
126
+ # Get a list of the available domains
127
+ #
128
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
129
+ # will be added to the HTTP request.
130
+ #
131
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
132
+ #
133
+ def get_domains_with_http_info(custom_headers:nil)
134
+ get_domains_async(custom_headers:custom_headers).value!
135
+ end
136
+
137
+ #
138
+ # Get a list of the available domains
139
+ #
140
+ # @param [Hash{String => String}] A hash of custom headers that will be added
141
+ # to the HTTP request.
142
+ #
143
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
144
+ #
145
+ def get_domains_async(custom_headers:nil)
146
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
147
+
148
+
149
+ request_headers = {}
150
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
151
+
152
+ # Set Headers
153
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
154
+ request_headers['Training-Key'] = api_key unless api_key.nil?
155
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
156
+ path_template = 'domains'
157
+
158
+ request_url = @base_url || self.base_url
159
+
160
+ options = {
161
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
162
+ headers: request_headers.merge(custom_headers || {}),
163
+ base_url: request_url
164
+ }
165
+ promise = self.make_request_async(:get, path_template, options)
166
+
167
+ promise = promise.then do |result|
168
+ http_response = result.response
169
+ status_code = http_response.status
170
+ response_content = http_response.body
171
+ unless status_code == 200
172
+ error_model = JSON.load(response_content)
173
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
174
+ end
175
+
176
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
177
+ # Deserialize Response
178
+ if status_code == 200
179
+ begin
180
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
181
+ result_mapper = {
182
+ client_side_validation: true,
183
+ required: false,
184
+ serialized_name: 'parsed_response',
185
+ type: {
186
+ name: 'Sequence',
187
+ element: {
188
+ client_side_validation: true,
189
+ required: false,
190
+ serialized_name: 'DomainElementType',
191
+ type: {
192
+ name: 'Composite',
193
+ class_name: 'Domain'
194
+ }
195
+ }
196
+ }
197
+ }
198
+ result.body = self.deserialize(result_mapper, parsed_response)
199
+ rescue Exception => e
200
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
201
+ end
202
+ end
203
+
204
+ result
205
+ end
206
+
207
+ promise.execute
208
+ end
209
+
210
+ #
211
+ # Get information about a specific domain
212
+ #
213
+ # @param domain_id The id of the domain to get information about
214
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
215
+ # will be added to the HTTP request.
216
+ #
217
+ # @return [Domain] operation results.
218
+ #
219
+ def get_domain(domain_id, custom_headers:nil)
220
+ response = get_domain_async(domain_id, custom_headers:custom_headers).value!
221
+ response.body unless response.nil?
222
+ end
223
+
224
+ #
225
+ # Get information about a specific domain
226
+ #
227
+ # @param domain_id The id of the domain to get information about
228
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
229
+ # will be added to the HTTP request.
230
+ #
231
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
232
+ #
233
+ def get_domain_with_http_info(domain_id, custom_headers:nil)
234
+ get_domain_async(domain_id, custom_headers:custom_headers).value!
235
+ end
236
+
237
+ #
238
+ # Get information about a specific domain
239
+ #
240
+ # @param domain_id The id of the domain to get information about
241
+ # @param [Hash{String => String}] A hash of custom headers that will be added
242
+ # to the HTTP request.
243
+ #
244
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
245
+ #
246
+ def get_domain_async(domain_id, custom_headers:nil)
247
+ fail ArgumentError, 'domain_id is nil' if domain_id.nil?
248
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
249
+
250
+
251
+ request_headers = {}
252
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
253
+
254
+ # Set Headers
255
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
256
+ request_headers['Training-Key'] = api_key unless api_key.nil?
257
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
258
+ path_template = 'domains/{domainId}'
259
+
260
+ request_url = @base_url || self.base_url
261
+
262
+ options = {
263
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
264
+ path_params: {'domainId' => domain_id},
265
+ headers: request_headers.merge(custom_headers || {}),
266
+ base_url: request_url
267
+ }
268
+ promise = self.make_request_async(:get, path_template, options)
269
+
270
+ promise = promise.then do |result|
271
+ http_response = result.response
272
+ status_code = http_response.status
273
+ response_content = http_response.body
274
+ unless status_code == 200
275
+ error_model = JSON.load(response_content)
276
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
277
+ end
278
+
279
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
280
+ # Deserialize Response
281
+ if status_code == 200
282
+ begin
283
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
284
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Domain.mapper()
285
+ result.body = self.deserialize(result_mapper, parsed_response)
286
+ rescue Exception => e
287
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
288
+ end
289
+ end
290
+
291
+ result
292
+ end
293
+
294
+ promise.execute
295
+ end
296
+
297
+ #
298
+ # Get tagged images for a given project iteration
299
+ #
300
+ # This API supports batching and range selection. By default it will only
301
+ # return first 50 images matching images.
302
+ # Use the {take} and {skip} parameters to control how many images to return in
303
+ # a given batch.
304
+ # The filtering is on an and/or relationship. For example, if the provided tag
305
+ # ids are for the "Dog" and
306
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
307
+ #
308
+ # @param project_id The project id
309
+ # @param iteration_id The iteration id. Defaults to workspace
310
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images.
311
+ # Defaults to all tagged images when null. Limited to 20
312
+ # @param order_by [Enum] The ordering. Defaults to newest. Possible values
313
+ # include: 'Newest', 'Oldest'
314
+ # @param take [Integer] Maximum number of images to return. Defaults to 50,
315
+ # limited to 256
316
+ # @param skip [Integer] Number of images to skip before beginning the image
317
+ # batch. Defaults to 0
318
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
319
+ # will be added to the HTTP request.
320
+ #
321
+ # @return [Array] operation results.
322
+ #
323
+ def get_tagged_images(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
324
+ response = get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
325
+ response.body unless response.nil?
326
+ end
327
+
328
+ #
329
+ # Get tagged images for a given project iteration
330
+ #
331
+ # This API supports batching and range selection. By default it will only
332
+ # return first 50 images matching images.
333
+ # Use the {take} and {skip} parameters to control how many images to return in
334
+ # a given batch.
335
+ # The filtering is on an and/or relationship. For example, if the provided tag
336
+ # ids are for the "Dog" and
337
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
338
+ #
339
+ # @param project_id The project id
340
+ # @param iteration_id The iteration id. Defaults to workspace
341
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images.
342
+ # Defaults to all tagged images when null. Limited to 20
343
+ # @param order_by [Enum] The ordering. Defaults to newest. Possible values
344
+ # include: 'Newest', 'Oldest'
345
+ # @param take [Integer] Maximum number of images to return. Defaults to 50,
346
+ # limited to 256
347
+ # @param skip [Integer] Number of images to skip before beginning the image
348
+ # batch. Defaults to 0
349
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
350
+ # will be added to the HTTP request.
351
+ #
352
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
353
+ #
354
+ def get_tagged_images_with_http_info(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
355
+ get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
356
+ end
357
+
358
+ #
359
+ # Get tagged images for a given project iteration
360
+ #
361
+ # This API supports batching and range selection. By default it will only
362
+ # return first 50 images matching images.
363
+ # Use the {take} and {skip} parameters to control how many images to return in
364
+ # a given batch.
365
+ # The filtering is on an and/or relationship. For example, if the provided tag
366
+ # ids are for the "Dog" and
367
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
368
+ #
369
+ # @param project_id The project id
370
+ # @param iteration_id The iteration id. Defaults to workspace
371
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images.
372
+ # Defaults to all tagged images when null. Limited to 20
373
+ # @param order_by [Enum] The ordering. Defaults to newest. Possible values
374
+ # include: 'Newest', 'Oldest'
375
+ # @param take [Integer] Maximum number of images to return. Defaults to 50,
376
+ # limited to 256
377
+ # @param skip [Integer] Number of images to skip before beginning the image
378
+ # batch. Defaults to 0
379
+ # @param [Hash{String => String}] A hash of custom headers that will be added
380
+ # to the HTTP request.
381
+ #
382
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
383
+ #
384
+ def get_tagged_images_async(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
385
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
386
+ fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
395
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
396
+ path_template = 'projects/{projectId}/images/tagged'
397
+
398
+ request_url = @base_url || self.base_url
399
+
400
+ options = {
401
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
402
+ path_params: {'projectId' => project_id},
403
+ query_params: {'iterationId' => iteration_id,'tagIds' => tag_ids.nil? ? nil : tag_ids.join(','),'orderBy' => order_by,'take' => take,'skip' => skip},
404
+ headers: request_headers.merge(custom_headers || {}),
405
+ base_url: request_url
406
+ }
407
+ promise = self.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 MsRestAzure::AzureOperationError.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
+ # Deserialize Response
420
+ if status_code == 200
421
+ begin
422
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
423
+ result_mapper = {
424
+ client_side_validation: true,
425
+ required: false,
426
+ serialized_name: 'parsed_response',
427
+ type: {
428
+ name: 'Sequence',
429
+ element: {
430
+ client_side_validation: true,
431
+ required: false,
432
+ serialized_name: 'ImageElementType',
433
+ type: {
434
+ name: 'Composite',
435
+ class_name: 'Image'
436
+ }
437
+ }
438
+ }
439
+ }
440
+ result.body = self.deserialize(result_mapper, parsed_response)
441
+ rescue Exception => e
442
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
443
+ end
444
+ end
445
+
446
+ result
447
+ end
448
+
449
+ promise.execute
450
+ end
451
+
452
+ #
453
+ # Get untagged images for a given project iteration
454
+ #
455
+ # This API supports batching and range selection. By default it will only
456
+ # return first 50 images matching images.
457
+ # Use the {take} and {skip} parameters to control how many images to return in
458
+ # a given batch.
459
+ #
460
+ # @param project_id The project id
461
+ # @param iteration_id The iteration id. Defaults to workspace
462
+ # @param order_by [Enum] The ordering. Defaults to newest. Possible values
463
+ # include: 'Newest', 'Oldest'
464
+ # @param take [Integer] Maximum number of images to return. Defaults to 50,
465
+ # limited to 256
466
+ # @param skip [Integer] Number of images to skip before beginning the image
467
+ # batch. Defaults to 0
468
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
469
+ # will be added to the HTTP request.
470
+ #
471
+ # @return [Array] operation results.
472
+ #
473
+ def get_untagged_images(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
474
+ response = get_untagged_images_async(project_id, iteration_id:iteration_id, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
475
+ response.body unless response.nil?
476
+ end
477
+
478
+ #
479
+ # Get untagged images for a given project iteration
480
+ #
481
+ # This API supports batching and range selection. By default it will only
482
+ # return first 50 images matching images.
483
+ # Use the {take} and {skip} parameters to control how many images to return in
484
+ # a given batch.
485
+ #
486
+ # @param project_id The project id
487
+ # @param iteration_id The iteration id. Defaults to workspace
488
+ # @param order_by [Enum] The ordering. Defaults to newest. Possible values
489
+ # include: 'Newest', 'Oldest'
490
+ # @param take [Integer] Maximum number of images to return. Defaults to 50,
491
+ # limited to 256
492
+ # @param skip [Integer] Number of images to skip before beginning the image
493
+ # batch. Defaults to 0
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 get_untagged_images_with_http_info(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
500
+ get_untagged_images_async(project_id, iteration_id:iteration_id, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
501
+ end
502
+
503
+ #
504
+ # Get untagged images for a given project iteration
505
+ #
506
+ # This API supports batching and range selection. By default it will only
507
+ # return first 50 images matching images.
508
+ # Use the {take} and {skip} parameters to control how many images to return in
509
+ # a given batch.
510
+ #
511
+ # @param project_id The project id
512
+ # @param iteration_id The iteration id. Defaults to workspace
513
+ # @param order_by [Enum] The ordering. Defaults to newest. Possible values
514
+ # include: 'Newest', 'Oldest'
515
+ # @param take [Integer] Maximum number of images to return. Defaults to 50,
516
+ # limited to 256
517
+ # @param skip [Integer] Number of images to skip before beginning the image
518
+ # batch. Defaults to 0
519
+ # @param [Hash{String => String}] A hash of custom headers that will be added
520
+ # to the HTTP request.
521
+ #
522
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
523
+ #
524
+ def get_untagged_images_async(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
525
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
526
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
527
+
528
+
529
+ request_headers = {}
530
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
531
+
532
+ # Set Headers
533
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
534
+ request_headers['Training-Key'] = api_key unless api_key.nil?
535
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
536
+ path_template = 'projects/{projectId}/images/untagged'
537
+
538
+ request_url = @base_url || self.base_url
539
+
540
+ options = {
541
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
542
+ path_params: {'projectId' => project_id},
543
+ query_params: {'iterationId' => iteration_id,'orderBy' => order_by,'take' => take,'skip' => skip},
544
+ headers: request_headers.merge(custom_headers || {}),
545
+ base_url: request_url
546
+ }
547
+ promise = self.make_request_async(:get, path_template, options)
548
+
549
+ promise = promise.then do |result|
550
+ http_response = result.response
551
+ status_code = http_response.status
552
+ response_content = http_response.body
553
+ unless status_code == 200
554
+ error_model = JSON.load(response_content)
555
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
556
+ end
557
+
558
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
559
+ # Deserialize Response
560
+ if status_code == 200
561
+ begin
562
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
563
+ result_mapper = {
564
+ client_side_validation: true,
565
+ required: false,
566
+ serialized_name: 'parsed_response',
567
+ type: {
568
+ name: 'Sequence',
569
+ element: {
570
+ client_side_validation: true,
571
+ required: false,
572
+ serialized_name: 'ImageElementType',
573
+ type: {
574
+ name: 'Composite',
575
+ class_name: 'Image'
576
+ }
577
+ }
578
+ }
579
+ }
580
+ result.body = self.deserialize(result_mapper, parsed_response)
581
+ rescue Exception => e
582
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
583
+ end
584
+ end
585
+
586
+ result
587
+ end
588
+
589
+ promise.execute
590
+ end
591
+
592
+ #
593
+ # Gets the number of images tagged with the provided {tagIds}
594
+ #
595
+ # The filtering is on an and/or relationship. For example, if the provided tag
596
+ # ids are for the "Dog" and
597
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
598
+ #
599
+ # @param project_id The project id
600
+ # @param iteration_id The iteration id. Defaults to workspace
601
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images to
602
+ # count. Defaults to all tags when null.
603
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
604
+ # will be added to the HTTP request.
605
+ #
606
+ # @return [Number] operation results.
607
+ #
608
+ def get_tagged_image_count(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
609
+ response = get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
610
+ response.body unless response.nil?
611
+ end
612
+
613
+ #
614
+ # Gets the number of images tagged with the provided {tagIds}
615
+ #
616
+ # The filtering is on an and/or relationship. For example, if the provided tag
617
+ # ids are for the "Dog" and
618
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
619
+ #
620
+ # @param project_id The project id
621
+ # @param iteration_id The iteration id. Defaults to workspace
622
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images to
623
+ # count. Defaults to all tags when null.
624
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
625
+ # will be added to the HTTP request.
626
+ #
627
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
628
+ #
629
+ def get_tagged_image_count_with_http_info(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
630
+ get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
631
+ end
632
+
633
+ #
634
+ # Gets the number of images tagged with the provided {tagIds}
635
+ #
636
+ # The filtering is on an and/or relationship. For example, if the provided tag
637
+ # ids are for the "Dog" and
638
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
639
+ #
640
+ # @param project_id The project id
641
+ # @param iteration_id The iteration id. Defaults to workspace
642
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images to
643
+ # count. Defaults to all tags when null.
644
+ # @param [Hash{String => String}] A hash of custom headers that will be added
645
+ # to the HTTP request.
646
+ #
647
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
648
+ #
649
+ def get_tagged_image_count_async(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
650
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
651
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
652
+
653
+
654
+ request_headers = {}
655
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
656
+
657
+ # Set Headers
658
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
659
+ request_headers['Training-Key'] = api_key unless api_key.nil?
660
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
661
+ path_template = 'projects/{projectId}/images/tagged/count'
662
+
663
+ request_url = @base_url || self.base_url
664
+
665
+ options = {
666
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
667
+ path_params: {'projectId' => project_id},
668
+ query_params: {'iterationId' => iteration_id,'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')},
669
+ headers: request_headers.merge(custom_headers || {}),
670
+ base_url: request_url
671
+ }
672
+ promise = self.make_request_async(:get, path_template, options)
673
+
674
+ promise = promise.then do |result|
675
+ http_response = result.response
676
+ status_code = http_response.status
677
+ response_content = http_response.body
678
+ unless status_code == 200
679
+ error_model = JSON.load(response_content)
680
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
681
+ end
682
+
683
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
684
+ # Deserialize Response
685
+ if status_code == 200
686
+ begin
687
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
688
+ result_mapper = {
689
+ client_side_validation: true,
690
+ required: false,
691
+ serialized_name: 'parsed_response',
692
+ type: {
693
+ name: 'Number'
694
+ }
695
+ }
696
+ result.body = self.deserialize(result_mapper, parsed_response)
697
+ rescue Exception => e
698
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
699
+ end
700
+ end
701
+
702
+ result
703
+ end
704
+
705
+ promise.execute
706
+ end
707
+
708
+ #
709
+ # Gets the number of untagged images
710
+ #
711
+ # This API returns the images which have no tags for a given project and
712
+ # optionally an iteration. If no iteration is specified the
713
+ # current workspace is used.
714
+ #
715
+ # @param project_id The project id
716
+ # @param iteration_id The iteration id. Defaults to workspace
717
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
718
+ # will be added to the HTTP request.
719
+ #
720
+ # @return [Number] operation results.
721
+ #
722
+ def get_untagged_image_count(project_id, iteration_id:nil, custom_headers:nil)
723
+ response = get_untagged_image_count_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
724
+ response.body unless response.nil?
725
+ end
726
+
727
+ #
728
+ # Gets the number of untagged images
729
+ #
730
+ # This API returns the images which have no tags for a given project and
731
+ # optionally an iteration. If no iteration is specified the
732
+ # current workspace is used.
733
+ #
734
+ # @param project_id The project id
735
+ # @param iteration_id The iteration id. Defaults to workspace
736
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
737
+ # will be added to the HTTP request.
738
+ #
739
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
740
+ #
741
+ def get_untagged_image_count_with_http_info(project_id, iteration_id:nil, custom_headers:nil)
742
+ get_untagged_image_count_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
743
+ end
744
+
745
+ #
746
+ # Gets the number of untagged images
747
+ #
748
+ # This API returns the images which have no tags for a given project and
749
+ # optionally an iteration. If no iteration is specified the
750
+ # current workspace is used.
751
+ #
752
+ # @param project_id The project id
753
+ # @param iteration_id The iteration id. Defaults to workspace
754
+ # @param [Hash{String => String}] A hash of custom headers that will be added
755
+ # to the HTTP request.
756
+ #
757
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
758
+ #
759
+ def get_untagged_image_count_async(project_id, iteration_id:nil, custom_headers:nil)
760
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
761
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
762
+
763
+
764
+ request_headers = {}
765
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
766
+
767
+ # Set Headers
768
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
769
+ request_headers['Training-Key'] = api_key unless api_key.nil?
770
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
771
+ path_template = 'projects/{projectId}/images/untagged/count'
772
+
773
+ request_url = @base_url || self.base_url
774
+
775
+ options = {
776
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
777
+ path_params: {'projectId' => project_id},
778
+ query_params: {'iterationId' => iteration_id},
779
+ headers: request_headers.merge(custom_headers || {}),
780
+ base_url: request_url
781
+ }
782
+ promise = self.make_request_async(:get, path_template, options)
783
+
784
+ promise = promise.then do |result|
785
+ http_response = result.response
786
+ status_code = http_response.status
787
+ response_content = http_response.body
788
+ unless status_code == 200
789
+ error_model = JSON.load(response_content)
790
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
791
+ end
792
+
793
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
794
+ # Deserialize Response
795
+ if status_code == 200
796
+ begin
797
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
798
+ result_mapper = {
799
+ client_side_validation: true,
800
+ required: false,
801
+ serialized_name: 'parsed_response',
802
+ type: {
803
+ name: 'Number'
804
+ }
805
+ }
806
+ result.body = self.deserialize(result_mapper, parsed_response)
807
+ rescue Exception => e
808
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
809
+ end
810
+ end
811
+
812
+ result
813
+ end
814
+
815
+ promise.execute
816
+ end
817
+
818
+ #
819
+ # Get images by id for a given project iteration
820
+ #
821
+ # This API will return a set of Images for the specified tags and optionally
822
+ # iteration. If no iteration is specified the
823
+ # current workspace is used.
824
+ #
825
+ # @param project_id The project id
826
+ # @param image_ids [Array<String>] The list of image ids to retrieve. Limited
827
+ # to 256
828
+ # @param iteration_id The iteration id. Defaults to workspace
829
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
830
+ # will be added to the HTTP request.
831
+ #
832
+ # @return [Array] operation results.
833
+ #
834
+ def get_images_by_ids(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil)
835
+ response = get_images_by_ids_async(project_id, image_ids:image_ids, iteration_id:iteration_id, custom_headers:custom_headers).value!
836
+ response.body unless response.nil?
837
+ end
838
+
839
+ #
840
+ # Get images by id for a given project iteration
841
+ #
842
+ # This API will return a set of Images for the specified tags and optionally
843
+ # iteration. If no iteration is specified the
844
+ # current workspace is used.
845
+ #
846
+ # @param project_id The project id
847
+ # @param image_ids [Array<String>] The list of image ids to retrieve. Limited
848
+ # to 256
849
+ # @param iteration_id The iteration id. Defaults to workspace
850
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
851
+ # will be added to the HTTP request.
852
+ #
853
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
854
+ #
855
+ def get_images_by_ids_with_http_info(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil)
856
+ get_images_by_ids_async(project_id, image_ids:image_ids, iteration_id:iteration_id, custom_headers:custom_headers).value!
857
+ end
858
+
859
+ #
860
+ # Get images by id for a given project iteration
861
+ #
862
+ # This API will return a set of Images for the specified tags and optionally
863
+ # iteration. If no iteration is specified the
864
+ # current workspace is used.
865
+ #
866
+ # @param project_id The project id
867
+ # @param image_ids [Array<String>] The list of image ids to retrieve. Limited
868
+ # to 256
869
+ # @param iteration_id The iteration id. Defaults to workspace
870
+ # @param [Hash{String => String}] A hash of custom headers that will be added
871
+ # to the HTTP request.
872
+ #
873
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
874
+ #
875
+ def get_images_by_ids_async(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil)
876
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
877
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
878
+
879
+
880
+ request_headers = {}
881
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
882
+
883
+ # Set Headers
884
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
885
+ request_headers['Training-Key'] = api_key unless api_key.nil?
886
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
887
+ path_template = 'projects/{projectId}/images/id'
888
+
889
+ request_url = @base_url || self.base_url
890
+
891
+ options = {
892
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
893
+ path_params: {'projectId' => project_id},
894
+ query_params: {'imageIds' => image_ids.nil? ? nil : image_ids.join(','),'iterationId' => iteration_id},
895
+ headers: request_headers.merge(custom_headers || {}),
896
+ base_url: request_url
897
+ }
898
+ promise = self.make_request_async(:get, path_template, options)
899
+
900
+ promise = promise.then do |result|
901
+ http_response = result.response
902
+ status_code = http_response.status
903
+ response_content = http_response.body
904
+ unless status_code == 200
905
+ error_model = JSON.load(response_content)
906
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
907
+ end
908
+
909
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
910
+ # Deserialize Response
911
+ if status_code == 200
912
+ begin
913
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
914
+ result_mapper = {
915
+ client_side_validation: true,
916
+ required: false,
917
+ serialized_name: 'parsed_response',
918
+ type: {
919
+ name: 'Sequence',
920
+ element: {
921
+ client_side_validation: true,
922
+ required: false,
923
+ serialized_name: 'ImageElementType',
924
+ type: {
925
+ name: 'Composite',
926
+ class_name: 'Image'
927
+ }
928
+ }
929
+ }
930
+ }
931
+ result.body = self.deserialize(result_mapper, parsed_response)
932
+ rescue Exception => e
933
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
934
+ end
935
+ end
936
+
937
+ result
938
+ end
939
+
940
+ promise.execute
941
+ end
942
+
943
+ #
944
+ # Add the provided images to the set of training images
945
+ #
946
+ # This API accepts body content as multipart/form-data and
947
+ # application/octet-stream. When using multipart
948
+ # multiple image files can be sent at once, with a maximum of 64 files
949
+ #
950
+ # @param project_id The project id
951
+ # @param image_data
952
+ # @param tag_ids [Array<String>] The tags ids with which to tag each image.
953
+ # Limited to 20
954
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
955
+ # will be added to the HTTP request.
956
+ #
957
+ # @return [ImageCreateSummary] operation results.
958
+ #
959
+ def create_images_from_data(project_id, image_data, tag_ids:nil, custom_headers:nil)
960
+ response = create_images_from_data_async(project_id, image_data, tag_ids:tag_ids, custom_headers:custom_headers).value!
961
+ response.body unless response.nil?
962
+ end
963
+
964
+ #
965
+ # Add the provided images to the set of training images
966
+ #
967
+ # This API accepts body content as multipart/form-data and
968
+ # application/octet-stream. When using multipart
969
+ # multiple image files can be sent at once, with a maximum of 64 files
970
+ #
971
+ # @param project_id The project id
972
+ # @param image_data
973
+ # @param tag_ids [Array<String>] The tags ids with which to tag each image.
974
+ # Limited to 20
975
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
976
+ # will be added to the HTTP request.
977
+ #
978
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
979
+ #
980
+ def create_images_from_data_with_http_info(project_id, image_data, tag_ids:nil, custom_headers:nil)
981
+ create_images_from_data_async(project_id, image_data, tag_ids:tag_ids, custom_headers:custom_headers).value!
982
+ end
983
+
984
+ #
985
+ # Add the provided images to the set of training images
986
+ #
987
+ # This API accepts body content as multipart/form-data and
988
+ # application/octet-stream. When using multipart
989
+ # multiple image files can be sent at once, with a maximum of 64 files
990
+ #
991
+ # @param project_id The project id
992
+ # @param image_data
993
+ # @param tag_ids [Array<String>] The tags ids with which to tag each image.
994
+ # Limited to 20
995
+ # @param [Hash{String => String}] A hash of custom headers that will be added
996
+ # to the HTTP request.
997
+ #
998
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
999
+ #
1000
+ def create_images_from_data_async(project_id, image_data, tag_ids:nil, custom_headers:nil)
1001
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1002
+ fail ArgumentError, 'image_data is nil' if image_data.nil?
1003
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1004
+
1005
+
1006
+ request_headers = {}
1007
+ request_headers['Content-Type'] = 'multipart/form-data'
1008
+
1009
+ # Set Headers
1010
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1011
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1012
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1013
+
1014
+ # Set Form Data
1015
+ form_data = {}
1016
+ form_data['imageData'] = image_data.to_s unless image_data.to_s.nil?
1017
+
1018
+ path_template = 'projects/{projectId}/images'
1019
+
1020
+ request_url = @base_url || self.base_url
1021
+
1022
+ options = {
1023
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1024
+ path_params: {'projectId' => project_id},
1025
+ query_params: {'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')},
1026
+ headers: request_headers.merge(custom_headers || {}),
1027
+ body: URI.encode_www_form(form_data),
1028
+ base_url: request_url
1029
+ }
1030
+ promise = self.make_request_async(:post, path_template, options)
1031
+
1032
+ promise = promise.then do |result|
1033
+ http_response = result.response
1034
+ status_code = http_response.status
1035
+ response_content = http_response.body
1036
+ unless status_code == 200
1037
+ error_model = JSON.load(response_content)
1038
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1039
+ end
1040
+
1041
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1042
+ # Deserialize Response
1043
+ if status_code == 200
1044
+ begin
1045
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1046
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageCreateSummary.mapper()
1047
+ result.body = self.deserialize(result_mapper, parsed_response)
1048
+ rescue Exception => e
1049
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1050
+ end
1051
+ end
1052
+
1053
+ result
1054
+ end
1055
+
1056
+ promise.execute
1057
+ end
1058
+
1059
+ #
1060
+ # Delete images from the set of training images
1061
+ #
1062
+ # @param project_id The project id
1063
+ # @param image_ids [Array<String>] Ids of the images to be deleted. Limted to
1064
+ # 256 images per batch
1065
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1066
+ # will be added to the HTTP request.
1067
+ #
1068
+ #
1069
+ def delete_images(project_id, image_ids, custom_headers:nil)
1070
+ response = delete_images_async(project_id, image_ids, custom_headers:custom_headers).value!
1071
+ nil
1072
+ end
1073
+
1074
+ #
1075
+ # Delete images from the set of training images
1076
+ #
1077
+ # @param project_id The project id
1078
+ # @param image_ids [Array<String>] Ids of the images to be deleted. Limted to
1079
+ # 256 images per batch
1080
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1081
+ # will be added to the HTTP request.
1082
+ #
1083
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1084
+ #
1085
+ def delete_images_with_http_info(project_id, image_ids, custom_headers:nil)
1086
+ delete_images_async(project_id, image_ids, custom_headers:custom_headers).value!
1087
+ end
1088
+
1089
+ #
1090
+ # Delete images from the set of training images
1091
+ #
1092
+ # @param project_id The project id
1093
+ # @param image_ids [Array<String>] Ids of the images to be deleted. Limted to
1094
+ # 256 images per batch
1095
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1096
+ # to the HTTP request.
1097
+ #
1098
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1099
+ #
1100
+ def delete_images_async(project_id, image_ids, custom_headers:nil)
1101
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1102
+ fail ArgumentError, 'image_ids is nil' if image_ids.nil?
1103
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1104
+
1105
+
1106
+ request_headers = {}
1107
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1108
+
1109
+ # Set Headers
1110
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1111
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1112
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1113
+ path_template = 'projects/{projectId}/images'
1114
+
1115
+ request_url = @base_url || self.base_url
1116
+
1117
+ options = {
1118
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1119
+ path_params: {'projectId' => project_id},
1120
+ query_params: {'imageIds' => image_ids.nil? ? nil : image_ids.join(',')},
1121
+ headers: request_headers.merge(custom_headers || {}),
1122
+ base_url: request_url
1123
+ }
1124
+ promise = self.make_request_async(:delete, path_template, options)
1125
+
1126
+ promise = promise.then do |result|
1127
+ http_response = result.response
1128
+ status_code = http_response.status
1129
+ response_content = http_response.body
1130
+ unless status_code == 204
1131
+ error_model = JSON.load(response_content)
1132
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1133
+ end
1134
+
1135
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1136
+
1137
+ result
1138
+ end
1139
+
1140
+ promise.execute
1141
+ end
1142
+
1143
+ #
1144
+ # Add the provided batch of images to the set of training images
1145
+ #
1146
+ # This API accepts a batch of files, and optionally tags, to create images.
1147
+ # There is a limit of 64 images and 20 tags.
1148
+ #
1149
+ # @param project_id The project id
1150
+ # @param batch [ImageFileCreateBatch] The batch of image files to add. Limited
1151
+ # to 64 images and 20 tags per batch
1152
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1153
+ # will be added to the HTTP request.
1154
+ #
1155
+ # @return [ImageCreateSummary] operation results.
1156
+ #
1157
+ def create_images_from_files(project_id, batch, custom_headers:nil)
1158
+ response = create_images_from_files_async(project_id, batch, custom_headers:custom_headers).value!
1159
+ response.body unless response.nil?
1160
+ end
1161
+
1162
+ #
1163
+ # Add the provided batch of images to the set of training images
1164
+ #
1165
+ # This API accepts a batch of files, and optionally tags, to create images.
1166
+ # There is a limit of 64 images and 20 tags.
1167
+ #
1168
+ # @param project_id The project id
1169
+ # @param batch [ImageFileCreateBatch] The batch of image files to add. Limited
1170
+ # to 64 images and 20 tags per batch
1171
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1172
+ # will be added to the HTTP request.
1173
+ #
1174
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1175
+ #
1176
+ def create_images_from_files_with_http_info(project_id, batch, custom_headers:nil)
1177
+ create_images_from_files_async(project_id, batch, custom_headers:custom_headers).value!
1178
+ end
1179
+
1180
+ #
1181
+ # Add the provided batch of images to the set of training images
1182
+ #
1183
+ # This API accepts a batch of files, and optionally tags, to create images.
1184
+ # There is a limit of 64 images and 20 tags.
1185
+ #
1186
+ # @param project_id The project id
1187
+ # @param batch [ImageFileCreateBatch] The batch of image files to add. Limited
1188
+ # to 64 images and 20 tags per batch
1189
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1190
+ # to the HTTP request.
1191
+ #
1192
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1193
+ #
1194
+ def create_images_from_files_async(project_id, batch, custom_headers:nil)
1195
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1196
+ fail ArgumentError, 'batch is nil' if batch.nil?
1197
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1198
+
1199
+
1200
+ request_headers = {}
1201
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1202
+
1203
+ # Set Headers
1204
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1205
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1206
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1207
+
1208
+ # Serialize Request
1209
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageFileCreateBatch.mapper()
1210
+ request_content = self.serialize(request_mapper, batch)
1211
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1212
+
1213
+ path_template = 'projects/{projectId}/images/files'
1214
+
1215
+ request_url = @base_url || self.base_url
1216
+
1217
+ options = {
1218
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1219
+ path_params: {'projectId' => project_id},
1220
+ body: request_content,
1221
+ headers: request_headers.merge(custom_headers || {}),
1222
+ base_url: request_url
1223
+ }
1224
+ promise = self.make_request_async(:post, path_template, options)
1225
+
1226
+ promise = promise.then do |result|
1227
+ http_response = result.response
1228
+ status_code = http_response.status
1229
+ response_content = http_response.body
1230
+ unless status_code == 200
1231
+ error_model = JSON.load(response_content)
1232
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1233
+ end
1234
+
1235
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1236
+ # Deserialize Response
1237
+ if status_code == 200
1238
+ begin
1239
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1240
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageCreateSummary.mapper()
1241
+ result.body = self.deserialize(result_mapper, parsed_response)
1242
+ rescue Exception => e
1243
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1244
+ end
1245
+ end
1246
+
1247
+ result
1248
+ end
1249
+
1250
+ promise.execute
1251
+ end
1252
+
1253
+ #
1254
+ # Add the provided images urls to the set of training images
1255
+ #
1256
+ # This API accepts a batch of urls, and optionally tags, to create images.
1257
+ # There is a limit of 64 images and 20 tags.
1258
+ #
1259
+ # @param project_id The project id
1260
+ # @param batch [ImageUrlCreateBatch] Image urls and tag ids. Limited to 64
1261
+ # images and 20 tags per batch
1262
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1263
+ # will be added to the HTTP request.
1264
+ #
1265
+ # @return [ImageCreateSummary] operation results.
1266
+ #
1267
+ def create_images_from_urls(project_id, batch, custom_headers:nil)
1268
+ response = create_images_from_urls_async(project_id, batch, custom_headers:custom_headers).value!
1269
+ response.body unless response.nil?
1270
+ end
1271
+
1272
+ #
1273
+ # Add the provided images urls to the set of training images
1274
+ #
1275
+ # This API accepts a batch of urls, and optionally tags, to create images.
1276
+ # There is a limit of 64 images and 20 tags.
1277
+ #
1278
+ # @param project_id The project id
1279
+ # @param batch [ImageUrlCreateBatch] Image urls and tag ids. Limited to 64
1280
+ # images and 20 tags per batch
1281
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1282
+ # will be added to the HTTP request.
1283
+ #
1284
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1285
+ #
1286
+ def create_images_from_urls_with_http_info(project_id, batch, custom_headers:nil)
1287
+ create_images_from_urls_async(project_id, batch, custom_headers:custom_headers).value!
1288
+ end
1289
+
1290
+ #
1291
+ # Add the provided images urls to the set of training images
1292
+ #
1293
+ # This API accepts a batch of urls, and optionally tags, to create images.
1294
+ # There is a limit of 64 images and 20 tags.
1295
+ #
1296
+ # @param project_id The project id
1297
+ # @param batch [ImageUrlCreateBatch] Image urls and tag ids. Limited to 64
1298
+ # images and 20 tags per batch
1299
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1300
+ # to the HTTP request.
1301
+ #
1302
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1303
+ #
1304
+ def create_images_from_urls_async(project_id, batch, custom_headers:nil)
1305
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1306
+ fail ArgumentError, 'batch is nil' if batch.nil?
1307
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1308
+
1309
+
1310
+ request_headers = {}
1311
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1312
+
1313
+ # Set Headers
1314
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1315
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1316
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1317
+
1318
+ # Serialize Request
1319
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageUrlCreateBatch.mapper()
1320
+ request_content = self.serialize(request_mapper, batch)
1321
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1322
+
1323
+ path_template = 'projects/{projectId}/images/urls'
1324
+
1325
+ request_url = @base_url || self.base_url
1326
+
1327
+ options = {
1328
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1329
+ path_params: {'projectId' => project_id},
1330
+ body: request_content,
1331
+ headers: request_headers.merge(custom_headers || {}),
1332
+ base_url: request_url
1333
+ }
1334
+ promise = self.make_request_async(:post, path_template, options)
1335
+
1336
+ promise = promise.then do |result|
1337
+ http_response = result.response
1338
+ status_code = http_response.status
1339
+ response_content = http_response.body
1340
+ unless status_code == 200
1341
+ error_model = JSON.load(response_content)
1342
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1343
+ end
1344
+
1345
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1346
+ # Deserialize Response
1347
+ if status_code == 200
1348
+ begin
1349
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1350
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageCreateSummary.mapper()
1351
+ result.body = self.deserialize(result_mapper, parsed_response)
1352
+ rescue Exception => e
1353
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1354
+ end
1355
+ end
1356
+
1357
+ result
1358
+ end
1359
+
1360
+ promise.execute
1361
+ end
1362
+
1363
+ #
1364
+ # Add the specified predicted images to the set of training images
1365
+ #
1366
+ # This API creates a batch of images from predicted images specified. There is
1367
+ # a limit of 64 images and 20 tags.
1368
+ #
1369
+ # @param project_id The project id
1370
+ # @param batch [ImageIdCreateBatch] Image and tag ids. Limted to 64 images and
1371
+ # 20 tags per batch
1372
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1373
+ # will be added to the HTTP request.
1374
+ #
1375
+ # @return [ImageCreateSummary] operation results.
1376
+ #
1377
+ def create_images_from_predictions(project_id, batch, custom_headers:nil)
1378
+ response = create_images_from_predictions_async(project_id, batch, custom_headers:custom_headers).value!
1379
+ response.body unless response.nil?
1380
+ end
1381
+
1382
+ #
1383
+ # Add the specified predicted images to the set of training images
1384
+ #
1385
+ # This API creates a batch of images from predicted images specified. There is
1386
+ # a limit of 64 images and 20 tags.
1387
+ #
1388
+ # @param project_id The project id
1389
+ # @param batch [ImageIdCreateBatch] Image and tag ids. Limted to 64 images and
1390
+ # 20 tags per batch
1391
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1392
+ # will be added to the HTTP request.
1393
+ #
1394
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1395
+ #
1396
+ def create_images_from_predictions_with_http_info(project_id, batch, custom_headers:nil)
1397
+ create_images_from_predictions_async(project_id, batch, custom_headers:custom_headers).value!
1398
+ end
1399
+
1400
+ #
1401
+ # Add the specified predicted images to the set of training images
1402
+ #
1403
+ # This API creates a batch of images from predicted images specified. There is
1404
+ # a limit of 64 images and 20 tags.
1405
+ #
1406
+ # @param project_id The project id
1407
+ # @param batch [ImageIdCreateBatch] Image and tag ids. Limted to 64 images and
1408
+ # 20 tags per batch
1409
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1410
+ # to the HTTP request.
1411
+ #
1412
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1413
+ #
1414
+ def create_images_from_predictions_async(project_id, batch, custom_headers:nil)
1415
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1416
+ fail ArgumentError, 'batch is nil' if batch.nil?
1417
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1418
+
1419
+
1420
+ request_headers = {}
1421
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1422
+
1423
+ # Set Headers
1424
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1425
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1426
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1427
+
1428
+ # Serialize Request
1429
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageIdCreateBatch.mapper()
1430
+ request_content = self.serialize(request_mapper, batch)
1431
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1432
+
1433
+ path_template = 'projects/{projectId}/images/predictions'
1434
+
1435
+ request_url = @base_url || self.base_url
1436
+
1437
+ options = {
1438
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1439
+ path_params: {'projectId' => project_id},
1440
+ body: request_content,
1441
+ headers: request_headers.merge(custom_headers || {}),
1442
+ base_url: request_url
1443
+ }
1444
+ promise = self.make_request_async(:post, path_template, options)
1445
+
1446
+ promise = promise.then do |result|
1447
+ http_response = result.response
1448
+ status_code = http_response.status
1449
+ response_content = http_response.body
1450
+ unless status_code == 200
1451
+ error_model = JSON.load(response_content)
1452
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1453
+ end
1454
+
1455
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1456
+ # Deserialize Response
1457
+ if status_code == 200
1458
+ begin
1459
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1460
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageCreateSummary.mapper()
1461
+ result.body = self.deserialize(result_mapper, parsed_response)
1462
+ rescue Exception => e
1463
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1464
+ end
1465
+ end
1466
+
1467
+ result
1468
+ end
1469
+
1470
+ promise.execute
1471
+ end
1472
+
1473
+ #
1474
+ # Associate a set of images with a set of tags
1475
+ #
1476
+ # @param project_id The project id
1477
+ # @param batch [ImageTagCreateBatch] Batch of image tags. Limited to 128 tags
1478
+ # per batch
1479
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1480
+ # will be added to the HTTP request.
1481
+ #
1482
+ # @return [ImageTagCreateSummary] operation results.
1483
+ #
1484
+ def create_image_tags(project_id, batch, custom_headers:nil)
1485
+ response = create_image_tags_async(project_id, batch, custom_headers:custom_headers).value!
1486
+ response.body unless response.nil?
1487
+ end
1488
+
1489
+ #
1490
+ # Associate a set of images with a set of tags
1491
+ #
1492
+ # @param project_id The project id
1493
+ # @param batch [ImageTagCreateBatch] Batch of image tags. Limited to 128 tags
1494
+ # per batch
1495
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1496
+ # will be added to the HTTP request.
1497
+ #
1498
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1499
+ #
1500
+ def create_image_tags_with_http_info(project_id, batch, custom_headers:nil)
1501
+ create_image_tags_async(project_id, batch, custom_headers:custom_headers).value!
1502
+ end
1503
+
1504
+ #
1505
+ # Associate a set of images with a set of tags
1506
+ #
1507
+ # @param project_id The project id
1508
+ # @param batch [ImageTagCreateBatch] Batch of image tags. Limited to 128 tags
1509
+ # per batch
1510
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1511
+ # to the HTTP request.
1512
+ #
1513
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1514
+ #
1515
+ def create_image_tags_async(project_id, batch, custom_headers:nil)
1516
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1517
+ fail ArgumentError, 'batch is nil' if batch.nil?
1518
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1519
+
1520
+
1521
+ request_headers = {}
1522
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1523
+
1524
+ # Set Headers
1525
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1526
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1527
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1528
+
1529
+ # Serialize Request
1530
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageTagCreateBatch.mapper()
1531
+ request_content = self.serialize(request_mapper, batch)
1532
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1533
+
1534
+ path_template = 'projects/{projectId}/images/tags'
1535
+
1536
+ request_url = @base_url || self.base_url
1537
+
1538
+ options = {
1539
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1540
+ path_params: {'projectId' => project_id},
1541
+ body: request_content,
1542
+ headers: request_headers.merge(custom_headers || {}),
1543
+ base_url: request_url
1544
+ }
1545
+ promise = self.make_request_async(:post, path_template, options)
1546
+
1547
+ promise = promise.then do |result|
1548
+ http_response = result.response
1549
+ status_code = http_response.status
1550
+ response_content = http_response.body
1551
+ unless status_code == 200
1552
+ error_model = JSON.load(response_content)
1553
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1554
+ end
1555
+
1556
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1557
+ # Deserialize Response
1558
+ if status_code == 200
1559
+ begin
1560
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1561
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageTagCreateSummary.mapper()
1562
+ result.body = self.deserialize(result_mapper, parsed_response)
1563
+ rescue Exception => e
1564
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1565
+ end
1566
+ end
1567
+
1568
+ result
1569
+ end
1570
+
1571
+ promise.execute
1572
+ end
1573
+
1574
+ #
1575
+ # Remove a set of tags from a set of images
1576
+ #
1577
+ # @param project_id The project id
1578
+ # @param image_ids [Array<String>] Image ids. Limited to 64 images
1579
+ # @param tag_ids [Array<String>] Tags to be deleted from the specified images.
1580
+ # Limted to 20 tags
1581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1582
+ # will be added to the HTTP request.
1583
+ #
1584
+ #
1585
+ def delete_image_tags(project_id, image_ids, tag_ids, custom_headers:nil)
1586
+ response = delete_image_tags_async(project_id, image_ids, tag_ids, custom_headers:custom_headers).value!
1587
+ nil
1588
+ end
1589
+
1590
+ #
1591
+ # Remove a set of tags from a set of images
1592
+ #
1593
+ # @param project_id The project id
1594
+ # @param image_ids [Array<String>] Image ids. Limited to 64 images
1595
+ # @param tag_ids [Array<String>] Tags to be deleted from the specified images.
1596
+ # Limted to 20 tags
1597
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1598
+ # will be added to the HTTP request.
1599
+ #
1600
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1601
+ #
1602
+ def delete_image_tags_with_http_info(project_id, image_ids, tag_ids, custom_headers:nil)
1603
+ delete_image_tags_async(project_id, image_ids, tag_ids, custom_headers:custom_headers).value!
1604
+ end
1605
+
1606
+ #
1607
+ # Remove a set of tags from a set of images
1608
+ #
1609
+ # @param project_id The project id
1610
+ # @param image_ids [Array<String>] Image ids. Limited to 64 images
1611
+ # @param tag_ids [Array<String>] Tags to be deleted from the specified images.
1612
+ # Limted to 20 tags
1613
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1614
+ # to the HTTP request.
1615
+ #
1616
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1617
+ #
1618
+ def delete_image_tags_async(project_id, image_ids, tag_ids, custom_headers:nil)
1619
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1620
+ fail ArgumentError, 'image_ids is nil' if image_ids.nil?
1621
+ fail ArgumentError, 'tag_ids is nil' if tag_ids.nil?
1622
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1623
+
1624
+
1625
+ request_headers = {}
1626
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1627
+
1628
+ # Set Headers
1629
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1630
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1631
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1632
+ path_template = 'projects/{projectId}/images/tags'
1633
+
1634
+ request_url = @base_url || self.base_url
1635
+
1636
+ options = {
1637
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1638
+ path_params: {'projectId' => project_id},
1639
+ query_params: {'imageIds' => image_ids.nil? ? nil : image_ids.join(','),'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')},
1640
+ headers: request_headers.merge(custom_headers || {}),
1641
+ base_url: request_url
1642
+ }
1643
+ promise = self.make_request_async(:delete, path_template, options)
1644
+
1645
+ promise = promise.then do |result|
1646
+ http_response = result.response
1647
+ status_code = http_response.status
1648
+ response_content = http_response.body
1649
+ unless status_code == 204
1650
+ error_model = JSON.load(response_content)
1651
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1652
+ end
1653
+
1654
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1655
+
1656
+ result
1657
+ end
1658
+
1659
+ promise.execute
1660
+ end
1661
+
1662
+ #
1663
+ # Create a set of image regions
1664
+ #
1665
+ # This API accepts a batch of image regions, and optionally tags, to update
1666
+ # existing images with region information.
1667
+ # There is a limit of 64 entries in the batch.
1668
+ #
1669
+ # @param project_id The project id
1670
+ # @param batch [ImageRegionCreateBatch] Batch of image regions which include a
1671
+ # tag and bounding box. Limited to 64
1672
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1673
+ # will be added to the HTTP request.
1674
+ #
1675
+ # @return [ImageRegionCreateSummary] operation results.
1676
+ #
1677
+ def create_image_regions(project_id, batch, custom_headers:nil)
1678
+ response = create_image_regions_async(project_id, batch, custom_headers:custom_headers).value!
1679
+ response.body unless response.nil?
1680
+ end
1681
+
1682
+ #
1683
+ # Create a set of image regions
1684
+ #
1685
+ # This API accepts a batch of image regions, and optionally tags, to update
1686
+ # existing images with region information.
1687
+ # There is a limit of 64 entries in the batch.
1688
+ #
1689
+ # @param project_id The project id
1690
+ # @param batch [ImageRegionCreateBatch] Batch of image regions which include a
1691
+ # tag and bounding box. Limited to 64
1692
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1693
+ # will be added to the HTTP request.
1694
+ #
1695
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1696
+ #
1697
+ def create_image_regions_with_http_info(project_id, batch, custom_headers:nil)
1698
+ create_image_regions_async(project_id, batch, custom_headers:custom_headers).value!
1699
+ end
1700
+
1701
+ #
1702
+ # Create a set of image regions
1703
+ #
1704
+ # This API accepts a batch of image regions, and optionally tags, to update
1705
+ # existing images with region information.
1706
+ # There is a limit of 64 entries in the batch.
1707
+ #
1708
+ # @param project_id The project id
1709
+ # @param batch [ImageRegionCreateBatch] Batch of image regions which include a
1710
+ # tag and bounding box. Limited to 64
1711
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1712
+ # to the HTTP request.
1713
+ #
1714
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1715
+ #
1716
+ def create_image_regions_async(project_id, batch, custom_headers:nil)
1717
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1718
+ fail ArgumentError, 'batch is nil' if batch.nil?
1719
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1720
+
1721
+
1722
+ request_headers = {}
1723
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1724
+
1725
+ # Set Headers
1726
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1727
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1728
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1729
+
1730
+ # Serialize Request
1731
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageRegionCreateBatch.mapper()
1732
+ request_content = self.serialize(request_mapper, batch)
1733
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1734
+
1735
+ path_template = 'projects/{projectId}/images/regions'
1736
+
1737
+ request_url = @base_url || self.base_url
1738
+
1739
+ options = {
1740
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1741
+ path_params: {'projectId' => project_id},
1742
+ body: request_content,
1743
+ headers: request_headers.merge(custom_headers || {}),
1744
+ base_url: request_url
1745
+ }
1746
+ promise = self.make_request_async(:post, path_template, options)
1747
+
1748
+ promise = promise.then do |result|
1749
+ http_response = result.response
1750
+ status_code = http_response.status
1751
+ response_content = http_response.body
1752
+ unless status_code == 200
1753
+ error_model = JSON.load(response_content)
1754
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1755
+ end
1756
+
1757
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1758
+ # Deserialize Response
1759
+ if status_code == 200
1760
+ begin
1761
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1762
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageRegionCreateSummary.mapper()
1763
+ result.body = self.deserialize(result_mapper, parsed_response)
1764
+ rescue Exception => e
1765
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1766
+ end
1767
+ end
1768
+
1769
+ result
1770
+ end
1771
+
1772
+ promise.execute
1773
+ end
1774
+
1775
+ #
1776
+ # Delete a set of image regions
1777
+ #
1778
+ # @param project_id The project id
1779
+ # @param region_ids [Array<String>] Regions to delete. Limited to 64
1780
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1781
+ # will be added to the HTTP request.
1782
+ #
1783
+ #
1784
+ def delete_image_regions(project_id, region_ids, custom_headers:nil)
1785
+ response = delete_image_regions_async(project_id, region_ids, custom_headers:custom_headers).value!
1786
+ nil
1787
+ end
1788
+
1789
+ #
1790
+ # Delete a set of image regions
1791
+ #
1792
+ # @param project_id The project id
1793
+ # @param region_ids [Array<String>] Regions to delete. Limited to 64
1794
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1795
+ # will be added to the HTTP request.
1796
+ #
1797
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1798
+ #
1799
+ def delete_image_regions_with_http_info(project_id, region_ids, custom_headers:nil)
1800
+ delete_image_regions_async(project_id, region_ids, custom_headers:custom_headers).value!
1801
+ end
1802
+
1803
+ #
1804
+ # Delete a set of image regions
1805
+ #
1806
+ # @param project_id The project id
1807
+ # @param region_ids [Array<String>] Regions to delete. Limited to 64
1808
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1809
+ # to the HTTP request.
1810
+ #
1811
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1812
+ #
1813
+ def delete_image_regions_async(project_id, region_ids, custom_headers:nil)
1814
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1815
+ fail ArgumentError, 'region_ids is nil' if region_ids.nil?
1816
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1817
+
1818
+
1819
+ request_headers = {}
1820
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1821
+
1822
+ # Set Headers
1823
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1824
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1825
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1826
+ path_template = 'projects/{projectId}/images/regions'
1827
+
1828
+ request_url = @base_url || self.base_url
1829
+
1830
+ options = {
1831
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1832
+ path_params: {'projectId' => project_id},
1833
+ query_params: {'regionIds' => region_ids.nil? ? nil : region_ids.join(',')},
1834
+ headers: request_headers.merge(custom_headers || {}),
1835
+ base_url: request_url
1836
+ }
1837
+ promise = self.make_request_async(:delete, path_template, options)
1838
+
1839
+ promise = promise.then do |result|
1840
+ http_response = result.response
1841
+ status_code = http_response.status
1842
+ response_content = http_response.body
1843
+ unless status_code == 204
1844
+ error_model = JSON.load(response_content)
1845
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1846
+ end
1847
+
1848
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1849
+
1850
+ result
1851
+ end
1852
+
1853
+ promise.execute
1854
+ end
1855
+
1856
+ #
1857
+ # Get region proposals for an image. Returns empty array if no proposals are
1858
+ # found.
1859
+ #
1860
+ # This API will get region proposals for an image along with confidences for
1861
+ # the region. It returns an empty array if no proposals are found.
1862
+ #
1863
+ # @param project_id The project id
1864
+ # @param image_id The image id
1865
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1866
+ # will be added to the HTTP request.
1867
+ #
1868
+ # @return [ImageRegionProposal] operation results.
1869
+ #
1870
+ def get_image_region_proposals(project_id, image_id, custom_headers:nil)
1871
+ response = get_image_region_proposals_async(project_id, image_id, custom_headers:custom_headers).value!
1872
+ response.body unless response.nil?
1873
+ end
1874
+
1875
+ #
1876
+ # Get region proposals for an image. Returns empty array if no proposals are
1877
+ # found.
1878
+ #
1879
+ # This API will get region proposals for an image along with confidences for
1880
+ # the region. It returns an empty array if no proposals are found.
1881
+ #
1882
+ # @param project_id The project id
1883
+ # @param image_id The image id
1884
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1885
+ # will be added to the HTTP request.
1886
+ #
1887
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1888
+ #
1889
+ def get_image_region_proposals_with_http_info(project_id, image_id, custom_headers:nil)
1890
+ get_image_region_proposals_async(project_id, image_id, custom_headers:custom_headers).value!
1891
+ end
1892
+
1893
+ #
1894
+ # Get region proposals for an image. Returns empty array if no proposals are
1895
+ # found.
1896
+ #
1897
+ # This API will get region proposals for an image along with confidences for
1898
+ # the region. It returns an empty array if no proposals are found.
1899
+ #
1900
+ # @param project_id The project id
1901
+ # @param image_id The image id
1902
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1903
+ # to the HTTP request.
1904
+ #
1905
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1906
+ #
1907
+ def get_image_region_proposals_async(project_id, image_id, custom_headers:nil)
1908
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1909
+ fail ArgumentError, 'image_id is nil' if image_id.nil?
1910
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
1911
+
1912
+
1913
+ request_headers = {}
1914
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1915
+
1916
+ # Set Headers
1917
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1918
+ request_headers['Training-Key'] = api_key unless api_key.nil?
1919
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
1920
+ path_template = '{projectId}/images/{imageId}/regionproposals'
1921
+
1922
+ request_url = @base_url || self.base_url
1923
+
1924
+ options = {
1925
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1926
+ path_params: {'projectId' => project_id,'imageId' => image_id},
1927
+ headers: request_headers.merge(custom_headers || {}),
1928
+ base_url: request_url
1929
+ }
1930
+ promise = self.make_request_async(:post, path_template, options)
1931
+
1932
+ promise = promise.then do |result|
1933
+ http_response = result.response
1934
+ status_code = http_response.status
1935
+ response_content = http_response.body
1936
+ unless status_code == 200
1937
+ error_model = JSON.load(response_content)
1938
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1939
+ end
1940
+
1941
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1942
+ # Deserialize Response
1943
+ if status_code == 200
1944
+ begin
1945
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1946
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageRegionProposal.mapper()
1947
+ result.body = self.deserialize(result_mapper, parsed_response)
1948
+ rescue Exception => e
1949
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1950
+ end
1951
+ end
1952
+
1953
+ result
1954
+ end
1955
+
1956
+ promise.execute
1957
+ end
1958
+
1959
+ #
1960
+ # Delete a set of predicted images and their associated prediction results
1961
+ #
1962
+ # @param project_id The project id
1963
+ # @param ids [Array<String>] The prediction ids. Limited to 64
1964
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1965
+ # will be added to the HTTP request.
1966
+ #
1967
+ #
1968
+ def delete_prediction(project_id, ids, custom_headers:nil)
1969
+ response = delete_prediction_async(project_id, ids, custom_headers:custom_headers).value!
1970
+ nil
1971
+ end
1972
+
1973
+ #
1974
+ # Delete a set of predicted images and their associated prediction results
1975
+ #
1976
+ # @param project_id The project id
1977
+ # @param ids [Array<String>] The prediction ids. Limited to 64
1978
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1979
+ # will be added to the HTTP request.
1980
+ #
1981
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1982
+ #
1983
+ def delete_prediction_with_http_info(project_id, ids, custom_headers:nil)
1984
+ delete_prediction_async(project_id, ids, custom_headers:custom_headers).value!
1985
+ end
1986
+
1987
+ #
1988
+ # Delete a set of predicted images and their associated prediction results
1989
+ #
1990
+ # @param project_id The project id
1991
+ # @param ids [Array<String>] The prediction ids. Limited to 64
1992
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1993
+ # to the HTTP request.
1994
+ #
1995
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1996
+ #
1997
+ def delete_prediction_async(project_id, ids, custom_headers:nil)
1998
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
1999
+ fail ArgumentError, 'ids is nil' if ids.nil?
2000
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2001
+
2002
+
2003
+ request_headers = {}
2004
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2005
+
2006
+ # Set Headers
2007
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2008
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2009
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2010
+ path_template = 'projects/{projectId}/predictions'
2011
+
2012
+ request_url = @base_url || self.base_url
2013
+
2014
+ options = {
2015
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2016
+ path_params: {'projectId' => project_id},
2017
+ query_params: {'ids' => ids.nil? ? nil : ids.join(',')},
2018
+ headers: request_headers.merge(custom_headers || {}),
2019
+ base_url: request_url
2020
+ }
2021
+ promise = self.make_request_async(:delete, path_template, options)
2022
+
2023
+ promise = promise.then do |result|
2024
+ http_response = result.response
2025
+ status_code = http_response.status
2026
+ response_content = http_response.body
2027
+ unless status_code == 204
2028
+ error_model = JSON.load(response_content)
2029
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2030
+ end
2031
+
2032
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2033
+
2034
+ result
2035
+ end
2036
+
2037
+ promise.execute
2038
+ end
2039
+
2040
+ #
2041
+ # Get images that were sent to your prediction endpoint
2042
+ #
2043
+ # @param project_id The project id
2044
+ # @param query [PredictionQueryToken] Parameters used to query the predictions.
2045
+ # Limited to combining 2 tags
2046
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2047
+ # will be added to the HTTP request.
2048
+ #
2049
+ # @return [PredictionQueryResult] operation results.
2050
+ #
2051
+ def query_predictions(project_id, query, custom_headers:nil)
2052
+ response = query_predictions_async(project_id, query, custom_headers:custom_headers).value!
2053
+ response.body unless response.nil?
2054
+ end
2055
+
2056
+ #
2057
+ # Get images that were sent to your prediction endpoint
2058
+ #
2059
+ # @param project_id The project id
2060
+ # @param query [PredictionQueryToken] Parameters used to query the predictions.
2061
+ # Limited to combining 2 tags
2062
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2063
+ # will be added to the HTTP request.
2064
+ #
2065
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2066
+ #
2067
+ def query_predictions_with_http_info(project_id, query, custom_headers:nil)
2068
+ query_predictions_async(project_id, query, custom_headers:custom_headers).value!
2069
+ end
2070
+
2071
+ #
2072
+ # Get images that were sent to your prediction endpoint
2073
+ #
2074
+ # @param project_id The project id
2075
+ # @param query [PredictionQueryToken] Parameters used to query the predictions.
2076
+ # Limited to combining 2 tags
2077
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2078
+ # to the HTTP request.
2079
+ #
2080
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2081
+ #
2082
+ def query_predictions_async(project_id, query, custom_headers:nil)
2083
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
2084
+ fail ArgumentError, 'query is nil' if query.nil?
2085
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2086
+
2087
+
2088
+ request_headers = {}
2089
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2090
+
2091
+ # Set Headers
2092
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2093
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2094
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2095
+
2096
+ # Serialize Request
2097
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::PredictionQueryToken.mapper()
2098
+ request_content = self.serialize(request_mapper, query)
2099
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2100
+
2101
+ path_template = 'projects/{projectId}/predictions/query'
2102
+
2103
+ request_url = @base_url || self.base_url
2104
+
2105
+ options = {
2106
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2107
+ path_params: {'projectId' => project_id},
2108
+ body: request_content,
2109
+ headers: request_headers.merge(custom_headers || {}),
2110
+ base_url: request_url
2111
+ }
2112
+ promise = self.make_request_async(:post, path_template, options)
2113
+
2114
+ promise = promise.then do |result|
2115
+ http_response = result.response
2116
+ status_code = http_response.status
2117
+ response_content = http_response.body
2118
+ unless status_code == 200
2119
+ error_model = JSON.load(response_content)
2120
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2121
+ end
2122
+
2123
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2124
+ # Deserialize Response
2125
+ if status_code == 200
2126
+ begin
2127
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2128
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::PredictionQueryResult.mapper()
2129
+ result.body = self.deserialize(result_mapper, parsed_response)
2130
+ rescue Exception => e
2131
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2132
+ end
2133
+ end
2134
+
2135
+ result
2136
+ end
2137
+
2138
+ promise.execute
2139
+ end
2140
+
2141
+ #
2142
+ # Quick test an image url
2143
+ #
2144
+ # @param project_id The project to evaluate against
2145
+ # @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
2146
+ # the url of the image to be evaluated
2147
+ # @param iteration_id Optional. Specifies the id of a particular iteration to
2148
+ # evaluate against.
2149
+ # The default iteration for the project will be used when not specified.
2150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2151
+ # will be added to the HTTP request.
2152
+ #
2153
+ # @return [ImagePrediction] operation results.
2154
+ #
2155
+ def quick_test_image_url(project_id, image_url, iteration_id:nil, custom_headers:nil)
2156
+ response = quick_test_image_url_async(project_id, image_url, iteration_id:iteration_id, custom_headers:custom_headers).value!
2157
+ response.body unless response.nil?
2158
+ end
2159
+
2160
+ #
2161
+ # Quick test an image url
2162
+ #
2163
+ # @param project_id The project to evaluate against
2164
+ # @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
2165
+ # the url of the image to be evaluated
2166
+ # @param iteration_id Optional. Specifies the id of a particular iteration to
2167
+ # evaluate against.
2168
+ # The default iteration for the project will be used when not specified.
2169
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2170
+ # will be added to the HTTP request.
2171
+ #
2172
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2173
+ #
2174
+ def quick_test_image_url_with_http_info(project_id, image_url, iteration_id:nil, custom_headers:nil)
2175
+ quick_test_image_url_async(project_id, image_url, iteration_id:iteration_id, custom_headers:custom_headers).value!
2176
+ end
2177
+
2178
+ #
2179
+ # Quick test an image url
2180
+ #
2181
+ # @param project_id The project to evaluate against
2182
+ # @param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
2183
+ # the url of the image to be evaluated
2184
+ # @param iteration_id Optional. Specifies the id of a particular iteration to
2185
+ # evaluate against.
2186
+ # The default iteration for the project will be used when not specified.
2187
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2188
+ # to the HTTP request.
2189
+ #
2190
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2191
+ #
2192
+ def quick_test_image_url_async(project_id, image_url, iteration_id:nil, custom_headers:nil)
2193
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
2194
+ fail ArgumentError, 'image_url is nil' if image_url.nil?
2195
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2196
+
2197
+
2198
+ request_headers = {}
2199
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2200
+
2201
+ # Set Headers
2202
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2203
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2204
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2205
+
2206
+ # Serialize Request
2207
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImageUrl.mapper()
2208
+ request_content = self.serialize(request_mapper, image_url)
2209
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2210
+
2211
+ path_template = 'projects/{projectId}/quicktest/url'
2212
+
2213
+ request_url = @base_url || self.base_url
2214
+
2215
+ options = {
2216
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2217
+ path_params: {'projectId' => project_id},
2218
+ query_params: {'iterationId' => iteration_id},
2219
+ body: request_content,
2220
+ headers: request_headers.merge(custom_headers || {}),
2221
+ base_url: request_url
2222
+ }
2223
+ promise = self.make_request_async(:post, path_template, options)
2224
+
2225
+ promise = promise.then do |result|
2226
+ http_response = result.response
2227
+ status_code = http_response.status
2228
+ response_content = http_response.body
2229
+ unless status_code == 200
2230
+ error_model = JSON.load(response_content)
2231
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2232
+ end
2233
+
2234
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2235
+ # Deserialize Response
2236
+ if status_code == 200
2237
+ begin
2238
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2239
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImagePrediction.mapper()
2240
+ result.body = self.deserialize(result_mapper, parsed_response)
2241
+ rescue Exception => e
2242
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2243
+ end
2244
+ end
2245
+
2246
+ result
2247
+ end
2248
+
2249
+ promise.execute
2250
+ end
2251
+
2252
+ #
2253
+ # Quick test an image
2254
+ #
2255
+ # @param project_id The project id
2256
+ # @param image_data
2257
+ # @param iteration_id Optional. Specifies the id of a particular iteration to
2258
+ # evaluate against.
2259
+ # The default iteration for the project will be used when not specified.
2260
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2261
+ # will be added to the HTTP request.
2262
+ #
2263
+ # @return [ImagePrediction] operation results.
2264
+ #
2265
+ def quick_test_image(project_id, image_data, iteration_id:nil, custom_headers:nil)
2266
+ response = quick_test_image_async(project_id, image_data, iteration_id:iteration_id, custom_headers:custom_headers).value!
2267
+ response.body unless response.nil?
2268
+ end
2269
+
2270
+ #
2271
+ # Quick test an image
2272
+ #
2273
+ # @param project_id The project id
2274
+ # @param image_data
2275
+ # @param iteration_id Optional. Specifies the id of a particular iteration to
2276
+ # evaluate against.
2277
+ # The default iteration for the project will be used when not specified.
2278
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2279
+ # will be added to the HTTP request.
2280
+ #
2281
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2282
+ #
2283
+ def quick_test_image_with_http_info(project_id, image_data, iteration_id:nil, custom_headers:nil)
2284
+ quick_test_image_async(project_id, image_data, iteration_id:iteration_id, custom_headers:custom_headers).value!
2285
+ end
2286
+
2287
+ #
2288
+ # Quick test an image
2289
+ #
2290
+ # @param project_id The project id
2291
+ # @param image_data
2292
+ # @param iteration_id Optional. Specifies the id of a particular iteration to
2293
+ # evaluate against.
2294
+ # The default iteration for the project will be used when not specified.
2295
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2296
+ # to the HTTP request.
2297
+ #
2298
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2299
+ #
2300
+ def quick_test_image_async(project_id, image_data, iteration_id:nil, custom_headers:nil)
2301
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
2302
+ fail ArgumentError, 'image_data is nil' if image_data.nil?
2303
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2304
+
2305
+
2306
+ request_headers = {}
2307
+ request_headers['Content-Type'] = 'multipart/form-data'
2308
+
2309
+ # Set Headers
2310
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2311
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2312
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2313
+
2314
+ # Set Form Data
2315
+ form_data = {}
2316
+ form_data['imageData'] = image_data.to_s unless image_data.to_s.nil?
2317
+
2318
+ path_template = 'projects/{projectId}/quicktest/image'
2319
+
2320
+ request_url = @base_url || self.base_url
2321
+
2322
+ options = {
2323
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2324
+ path_params: {'projectId' => project_id},
2325
+ query_params: {'iterationId' => iteration_id},
2326
+ headers: request_headers.merge(custom_headers || {}),
2327
+ body: URI.encode_www_form(form_data),
2328
+ base_url: request_url
2329
+ }
2330
+ promise = self.make_request_async(:post, path_template, options)
2331
+
2332
+ promise = promise.then do |result|
2333
+ http_response = result.response
2334
+ status_code = http_response.status
2335
+ response_content = http_response.body
2336
+ unless status_code == 200
2337
+ error_model = JSON.load(response_content)
2338
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2339
+ end
2340
+
2341
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2342
+ # Deserialize Response
2343
+ if status_code == 200
2344
+ begin
2345
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2346
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::ImagePrediction.mapper()
2347
+ result.body = self.deserialize(result_mapper, parsed_response)
2348
+ rescue Exception => e
2349
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2350
+ end
2351
+ end
2352
+
2353
+ result
2354
+ end
2355
+
2356
+ promise.execute
2357
+ end
2358
+
2359
+ #
2360
+ # Queues project for training
2361
+ #
2362
+ # @param project_id The project id
2363
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2364
+ # will be added to the HTTP request.
2365
+ #
2366
+ # @return [Iteration] operation results.
2367
+ #
2368
+ def train_project(project_id, custom_headers:nil)
2369
+ response = train_project_async(project_id, custom_headers:custom_headers).value!
2370
+ response.body unless response.nil?
2371
+ end
2372
+
2373
+ #
2374
+ # Queues project for training
2375
+ #
2376
+ # @param project_id The project id
2377
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2378
+ # will be added to the HTTP request.
2379
+ #
2380
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2381
+ #
2382
+ def train_project_with_http_info(project_id, custom_headers:nil)
2383
+ train_project_async(project_id, custom_headers:custom_headers).value!
2384
+ end
2385
+
2386
+ #
2387
+ # Queues project for training
2388
+ #
2389
+ # @param project_id The project id
2390
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2391
+ # to the HTTP request.
2392
+ #
2393
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2394
+ #
2395
+ def train_project_async(project_id, custom_headers:nil)
2396
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
2397
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2398
+
2399
+
2400
+ request_headers = {}
2401
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2402
+
2403
+ # Set Headers
2404
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2405
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2406
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2407
+ path_template = 'projects/{projectId}/train'
2408
+
2409
+ request_url = @base_url || self.base_url
2410
+
2411
+ options = {
2412
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2413
+ path_params: {'projectId' => project_id},
2414
+ headers: request_headers.merge(custom_headers || {}),
2415
+ base_url: request_url
2416
+ }
2417
+ promise = self.make_request_async(:post, path_template, options)
2418
+
2419
+ promise = promise.then do |result|
2420
+ http_response = result.response
2421
+ status_code = http_response.status
2422
+ response_content = http_response.body
2423
+ unless status_code == 200
2424
+ error_model = JSON.load(response_content)
2425
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2426
+ end
2427
+
2428
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2429
+ # Deserialize Response
2430
+ if status_code == 200
2431
+ begin
2432
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2433
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Iteration.mapper()
2434
+ result.body = self.deserialize(result_mapper, parsed_response)
2435
+ rescue Exception => e
2436
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2437
+ end
2438
+ end
2439
+
2440
+ result
2441
+ end
2442
+
2443
+ promise.execute
2444
+ end
2445
+
2446
+ #
2447
+ # Get your projects
2448
+ #
2449
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2450
+ # will be added to the HTTP request.
2451
+ #
2452
+ # @return [Array] operation results.
2453
+ #
2454
+ def get_projects(custom_headers:nil)
2455
+ response = get_projects_async(custom_headers:custom_headers).value!
2456
+ response.body unless response.nil?
2457
+ end
2458
+
2459
+ #
2460
+ # Get your projects
2461
+ #
2462
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2463
+ # will be added to the HTTP request.
2464
+ #
2465
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2466
+ #
2467
+ def get_projects_with_http_info(custom_headers:nil)
2468
+ get_projects_async(custom_headers:custom_headers).value!
2469
+ end
2470
+
2471
+ #
2472
+ # Get your projects
2473
+ #
2474
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2475
+ # to the HTTP request.
2476
+ #
2477
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2478
+ #
2479
+ def get_projects_async(custom_headers:nil)
2480
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2481
+
2482
+
2483
+ request_headers = {}
2484
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2485
+
2486
+ # Set Headers
2487
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2488
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2489
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2490
+ path_template = 'projects'
2491
+
2492
+ request_url = @base_url || self.base_url
2493
+
2494
+ options = {
2495
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2496
+ headers: request_headers.merge(custom_headers || {}),
2497
+ base_url: request_url
2498
+ }
2499
+ promise = self.make_request_async(:get, path_template, options)
2500
+
2501
+ promise = promise.then do |result|
2502
+ http_response = result.response
2503
+ status_code = http_response.status
2504
+ response_content = http_response.body
2505
+ unless status_code == 200
2506
+ error_model = JSON.load(response_content)
2507
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2508
+ end
2509
+
2510
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2511
+ # Deserialize Response
2512
+ if status_code == 200
2513
+ begin
2514
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2515
+ result_mapper = {
2516
+ client_side_validation: true,
2517
+ required: false,
2518
+ serialized_name: 'parsed_response',
2519
+ type: {
2520
+ name: 'Sequence',
2521
+ element: {
2522
+ client_side_validation: true,
2523
+ required: false,
2524
+ serialized_name: 'ProjectElementType',
2525
+ type: {
2526
+ name: 'Composite',
2527
+ class_name: 'Project'
2528
+ }
2529
+ }
2530
+ }
2531
+ }
2532
+ result.body = self.deserialize(result_mapper, parsed_response)
2533
+ rescue Exception => e
2534
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2535
+ end
2536
+ end
2537
+
2538
+ result
2539
+ end
2540
+
2541
+ promise.execute
2542
+ end
2543
+
2544
+ #
2545
+ # Create a project
2546
+ #
2547
+ # @param name [String] Name of the project
2548
+ # @param description [String] The description of the project
2549
+ # @param domain_id The id of the domain to use for this project. Defaults to
2550
+ # General
2551
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2552
+ # will be added to the HTTP request.
2553
+ #
2554
+ # @return [Project] operation results.
2555
+ #
2556
+ def create_project(name, description:nil, domain_id:nil, custom_headers:nil)
2557
+ response = create_project_async(name, description:description, domain_id:domain_id, custom_headers:custom_headers).value!
2558
+ response.body unless response.nil?
2559
+ end
2560
+
2561
+ #
2562
+ # Create a project
2563
+ #
2564
+ # @param name [String] Name of the project
2565
+ # @param description [String] The description of the project
2566
+ # @param domain_id The id of the domain to use for this project. Defaults to
2567
+ # General
2568
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2569
+ # will be added to the HTTP request.
2570
+ #
2571
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2572
+ #
2573
+ def create_project_with_http_info(name, description:nil, domain_id:nil, custom_headers:nil)
2574
+ create_project_async(name, description:description, domain_id:domain_id, custom_headers:custom_headers).value!
2575
+ end
2576
+
2577
+ #
2578
+ # Create a project
2579
+ #
2580
+ # @param name [String] Name of the project
2581
+ # @param description [String] The description of the project
2582
+ # @param domain_id The id of the domain to use for this project. Defaults to
2583
+ # General
2584
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2585
+ # to the HTTP request.
2586
+ #
2587
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2588
+ #
2589
+ def create_project_async(name, description:nil, domain_id:nil, custom_headers:nil)
2590
+ fail ArgumentError, 'name is nil' if name.nil?
2591
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2592
+
2593
+
2594
+ request_headers = {}
2595
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2596
+
2597
+ # Set Headers
2598
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2599
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2600
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2601
+ path_template = 'projects'
2602
+
2603
+ request_url = @base_url || self.base_url
2604
+
2605
+ options = {
2606
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2607
+ query_params: {'name' => name,'description' => description,'domainId' => domain_id},
2608
+ headers: request_headers.merge(custom_headers || {}),
2609
+ base_url: request_url
2610
+ }
2611
+ promise = self.make_request_async(:post, path_template, options)
2612
+
2613
+ promise = promise.then do |result|
2614
+ http_response = result.response
2615
+ status_code = http_response.status
2616
+ response_content = http_response.body
2617
+ unless status_code == 200
2618
+ error_model = JSON.load(response_content)
2619
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2620
+ end
2621
+
2622
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2623
+ # Deserialize Response
2624
+ if status_code == 200
2625
+ begin
2626
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2627
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Project.mapper()
2628
+ result.body = self.deserialize(result_mapper, parsed_response)
2629
+ rescue Exception => e
2630
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2631
+ end
2632
+ end
2633
+
2634
+ result
2635
+ end
2636
+
2637
+ promise.execute
2638
+ end
2639
+
2640
+ #
2641
+ # Get a specific project
2642
+ #
2643
+ # @param project_id The id of the project to get
2644
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2645
+ # will be added to the HTTP request.
2646
+ #
2647
+ # @return [Project] operation results.
2648
+ #
2649
+ def get_project(project_id, custom_headers:nil)
2650
+ response = get_project_async(project_id, custom_headers:custom_headers).value!
2651
+ response.body unless response.nil?
2652
+ end
2653
+
2654
+ #
2655
+ # Get a specific project
2656
+ #
2657
+ # @param project_id The id of the project to get
2658
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2659
+ # will be added to the HTTP request.
2660
+ #
2661
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2662
+ #
2663
+ def get_project_with_http_info(project_id, custom_headers:nil)
2664
+ get_project_async(project_id, custom_headers:custom_headers).value!
2665
+ end
2666
+
2667
+ #
2668
+ # Get a specific project
2669
+ #
2670
+ # @param project_id The id of the project to get
2671
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2672
+ # to the HTTP request.
2673
+ #
2674
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2675
+ #
2676
+ def get_project_async(project_id, custom_headers:nil)
2677
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
2678
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2679
+
2680
+
2681
+ request_headers = {}
2682
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2683
+
2684
+ # Set Headers
2685
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2686
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2687
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2688
+ path_template = 'projects/{projectId}'
2689
+
2690
+ request_url = @base_url || self.base_url
2691
+
2692
+ options = {
2693
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2694
+ path_params: {'projectId' => project_id},
2695
+ headers: request_headers.merge(custom_headers || {}),
2696
+ base_url: request_url
2697
+ }
2698
+ promise = self.make_request_async(:get, path_template, options)
2699
+
2700
+ promise = promise.then do |result|
2701
+ http_response = result.response
2702
+ status_code = http_response.status
2703
+ response_content = http_response.body
2704
+ unless status_code == 200
2705
+ error_model = JSON.load(response_content)
2706
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2707
+ end
2708
+
2709
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2710
+ # Deserialize Response
2711
+ if status_code == 200
2712
+ begin
2713
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2714
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Project.mapper()
2715
+ result.body = self.deserialize(result_mapper, parsed_response)
2716
+ rescue Exception => e
2717
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2718
+ end
2719
+ end
2720
+
2721
+ result
2722
+ end
2723
+
2724
+ promise.execute
2725
+ end
2726
+
2727
+ #
2728
+ # Delete a specific project
2729
+ #
2730
+ # @param project_id The project id
2731
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2732
+ # will be added to the HTTP request.
2733
+ #
2734
+ #
2735
+ def delete_project(project_id, custom_headers:nil)
2736
+ response = delete_project_async(project_id, custom_headers:custom_headers).value!
2737
+ nil
2738
+ end
2739
+
2740
+ #
2741
+ # Delete a specific project
2742
+ #
2743
+ # @param project_id The project id
2744
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2745
+ # will be added to the HTTP request.
2746
+ #
2747
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2748
+ #
2749
+ def delete_project_with_http_info(project_id, custom_headers:nil)
2750
+ delete_project_async(project_id, custom_headers:custom_headers).value!
2751
+ end
2752
+
2753
+ #
2754
+ # Delete a specific project
2755
+ #
2756
+ # @param project_id The project id
2757
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2758
+ # to the HTTP request.
2759
+ #
2760
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2761
+ #
2762
+ def delete_project_async(project_id, custom_headers:nil)
2763
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
2764
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2765
+
2766
+
2767
+ request_headers = {}
2768
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2769
+
2770
+ # Set Headers
2771
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2772
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2773
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2774
+ path_template = 'projects/{projectId}'
2775
+
2776
+ request_url = @base_url || self.base_url
2777
+
2778
+ options = {
2779
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2780
+ path_params: {'projectId' => project_id},
2781
+ headers: request_headers.merge(custom_headers || {}),
2782
+ base_url: request_url
2783
+ }
2784
+ promise = self.make_request_async(:delete, path_template, options)
2785
+
2786
+ promise = promise.then do |result|
2787
+ http_response = result.response
2788
+ status_code = http_response.status
2789
+ response_content = http_response.body
2790
+ unless status_code == 204
2791
+ error_model = JSON.load(response_content)
2792
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2793
+ end
2794
+
2795
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2796
+
2797
+ result
2798
+ end
2799
+
2800
+ promise.execute
2801
+ end
2802
+
2803
+ #
2804
+ # Update a specific project
2805
+ #
2806
+ # @param project_id The id of the project to update
2807
+ # @param updated_project [Project] The updated project model
2808
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2809
+ # will be added to the HTTP request.
2810
+ #
2811
+ # @return [Project] operation results.
2812
+ #
2813
+ def update_project(project_id, updated_project, custom_headers:nil)
2814
+ response = update_project_async(project_id, updated_project, custom_headers:custom_headers).value!
2815
+ response.body unless response.nil?
2816
+ end
2817
+
2818
+ #
2819
+ # Update a specific project
2820
+ #
2821
+ # @param project_id The id of the project to update
2822
+ # @param updated_project [Project] The updated project model
2823
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2824
+ # will be added to the HTTP request.
2825
+ #
2826
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2827
+ #
2828
+ def update_project_with_http_info(project_id, updated_project, custom_headers:nil)
2829
+ update_project_async(project_id, updated_project, custom_headers:custom_headers).value!
2830
+ end
2831
+
2832
+ #
2833
+ # Update a specific project
2834
+ #
2835
+ # @param project_id The id of the project to update
2836
+ # @param updated_project [Project] The updated project model
2837
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2838
+ # to the HTTP request.
2839
+ #
2840
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2841
+ #
2842
+ def update_project_async(project_id, updated_project, custom_headers:nil)
2843
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
2844
+ fail ArgumentError, 'updated_project is nil' if updated_project.nil?
2845
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2846
+
2847
+
2848
+ request_headers = {}
2849
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2850
+
2851
+ # Set Headers
2852
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2853
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2854
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2855
+
2856
+ # Serialize Request
2857
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Project.mapper()
2858
+ request_content = self.serialize(request_mapper, updated_project)
2859
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2860
+
2861
+ path_template = 'projects/{projectId}'
2862
+
2863
+ request_url = @base_url || self.base_url
2864
+
2865
+ options = {
2866
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2867
+ path_params: {'projectId' => project_id},
2868
+ body: request_content,
2869
+ headers: request_headers.merge(custom_headers || {}),
2870
+ base_url: request_url
2871
+ }
2872
+ promise = self.make_request_async(:patch, path_template, options)
2873
+
2874
+ promise = promise.then do |result|
2875
+ http_response = result.response
2876
+ status_code = http_response.status
2877
+ response_content = http_response.body
2878
+ unless status_code == 200
2879
+ error_model = JSON.load(response_content)
2880
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2881
+ end
2882
+
2883
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2884
+ # Deserialize Response
2885
+ if status_code == 200
2886
+ begin
2887
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2888
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Project.mapper()
2889
+ result.body = self.deserialize(result_mapper, parsed_response)
2890
+ rescue Exception => e
2891
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2892
+ end
2893
+ end
2894
+
2895
+ result
2896
+ end
2897
+
2898
+ promise.execute
2899
+ end
2900
+
2901
+ #
2902
+ # Get iterations for the project
2903
+ #
2904
+ # @param project_id The project id
2905
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2906
+ # will be added to the HTTP request.
2907
+ #
2908
+ # @return [Array] operation results.
2909
+ #
2910
+ def get_iterations(project_id, custom_headers:nil)
2911
+ response = get_iterations_async(project_id, custom_headers:custom_headers).value!
2912
+ response.body unless response.nil?
2913
+ end
2914
+
2915
+ #
2916
+ # Get iterations for the project
2917
+ #
2918
+ # @param project_id The project id
2919
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2920
+ # will be added to the HTTP request.
2921
+ #
2922
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2923
+ #
2924
+ def get_iterations_with_http_info(project_id, custom_headers:nil)
2925
+ get_iterations_async(project_id, custom_headers:custom_headers).value!
2926
+ end
2927
+
2928
+ #
2929
+ # Get iterations for the project
2930
+ #
2931
+ # @param project_id The project id
2932
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2933
+ # to the HTTP request.
2934
+ #
2935
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2936
+ #
2937
+ def get_iterations_async(project_id, custom_headers:nil)
2938
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
2939
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
2940
+
2941
+
2942
+ request_headers = {}
2943
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2944
+
2945
+ # Set Headers
2946
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2947
+ request_headers['Training-Key'] = api_key unless api_key.nil?
2948
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
2949
+ path_template = 'projects/{projectId}/iterations'
2950
+
2951
+ request_url = @base_url || self.base_url
2952
+
2953
+ options = {
2954
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2955
+ path_params: {'projectId' => project_id},
2956
+ headers: request_headers.merge(custom_headers || {}),
2957
+ base_url: request_url
2958
+ }
2959
+ promise = self.make_request_async(:get, path_template, options)
2960
+
2961
+ promise = promise.then do |result|
2962
+ http_response = result.response
2963
+ status_code = http_response.status
2964
+ response_content = http_response.body
2965
+ unless status_code == 200
2966
+ error_model = JSON.load(response_content)
2967
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2968
+ end
2969
+
2970
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2971
+ # Deserialize Response
2972
+ if status_code == 200
2973
+ begin
2974
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2975
+ result_mapper = {
2976
+ client_side_validation: true,
2977
+ required: false,
2978
+ serialized_name: 'parsed_response',
2979
+ type: {
2980
+ name: 'Sequence',
2981
+ element: {
2982
+ client_side_validation: true,
2983
+ required: false,
2984
+ serialized_name: 'IterationElementType',
2985
+ type: {
2986
+ name: 'Composite',
2987
+ class_name: 'Iteration'
2988
+ }
2989
+ }
2990
+ }
2991
+ }
2992
+ result.body = self.deserialize(result_mapper, parsed_response)
2993
+ rescue Exception => e
2994
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2995
+ end
2996
+ end
2997
+
2998
+ result
2999
+ end
3000
+
3001
+ promise.execute
3002
+ end
3003
+
3004
+ #
3005
+ # Get a specific iteration
3006
+ #
3007
+ # @param project_id The id of the project the iteration belongs to
3008
+ # @param iteration_id The id of the iteration to get
3009
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3010
+ # will be added to the HTTP request.
3011
+ #
3012
+ # @return [Iteration] operation results.
3013
+ #
3014
+ def get_iteration(project_id, iteration_id, custom_headers:nil)
3015
+ response = get_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
3016
+ response.body unless response.nil?
3017
+ end
3018
+
3019
+ #
3020
+ # Get a specific iteration
3021
+ #
3022
+ # @param project_id The id of the project the iteration belongs to
3023
+ # @param iteration_id The id of the iteration to get
3024
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3025
+ # will be added to the HTTP request.
3026
+ #
3027
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3028
+ #
3029
+ def get_iteration_with_http_info(project_id, iteration_id, custom_headers:nil)
3030
+ get_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
3031
+ end
3032
+
3033
+ #
3034
+ # Get a specific iteration
3035
+ #
3036
+ # @param project_id The id of the project the iteration belongs to
3037
+ # @param iteration_id The id of the iteration to get
3038
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3039
+ # to the HTTP request.
3040
+ #
3041
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3042
+ #
3043
+ def get_iteration_async(project_id, iteration_id, custom_headers:nil)
3044
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
3045
+ fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
3046
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
3047
+
3048
+
3049
+ request_headers = {}
3050
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3051
+
3052
+ # Set Headers
3053
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3054
+ request_headers['Training-Key'] = api_key unless api_key.nil?
3055
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
3056
+ path_template = 'projects/{projectId}/iterations/{iterationId}'
3057
+
3058
+ request_url = @base_url || self.base_url
3059
+
3060
+ options = {
3061
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3062
+ path_params: {'projectId' => project_id,'iterationId' => iteration_id},
3063
+ headers: request_headers.merge(custom_headers || {}),
3064
+ base_url: request_url
3065
+ }
3066
+ promise = self.make_request_async(:get, path_template, options)
3067
+
3068
+ promise = promise.then do |result|
3069
+ http_response = result.response
3070
+ status_code = http_response.status
3071
+ response_content = http_response.body
3072
+ unless status_code == 200
3073
+ error_model = JSON.load(response_content)
3074
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3075
+ end
3076
+
3077
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3078
+ # Deserialize Response
3079
+ if status_code == 200
3080
+ begin
3081
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3082
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Iteration.mapper()
3083
+ result.body = self.deserialize(result_mapper, parsed_response)
3084
+ rescue Exception => e
3085
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3086
+ end
3087
+ end
3088
+
3089
+ result
3090
+ end
3091
+
3092
+ promise.execute
3093
+ end
3094
+
3095
+ #
3096
+ # Delete a specific iteration of a project
3097
+ #
3098
+ # @param project_id The project id
3099
+ # @param iteration_id The iteration id
3100
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3101
+ # will be added to the HTTP request.
3102
+ #
3103
+ #
3104
+ def delete_iteration(project_id, iteration_id, custom_headers:nil)
3105
+ response = delete_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
3106
+ nil
3107
+ end
3108
+
3109
+ #
3110
+ # Delete a specific iteration of a project
3111
+ #
3112
+ # @param project_id The project id
3113
+ # @param iteration_id The iteration id
3114
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3115
+ # will be added to the HTTP request.
3116
+ #
3117
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3118
+ #
3119
+ def delete_iteration_with_http_info(project_id, iteration_id, custom_headers:nil)
3120
+ delete_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
3121
+ end
3122
+
3123
+ #
3124
+ # Delete a specific iteration of a project
3125
+ #
3126
+ # @param project_id The project id
3127
+ # @param iteration_id The iteration id
3128
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3129
+ # to the HTTP request.
3130
+ #
3131
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3132
+ #
3133
+ def delete_iteration_async(project_id, iteration_id, custom_headers:nil)
3134
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
3135
+ fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
3136
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
3137
+
3138
+
3139
+ request_headers = {}
3140
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3141
+
3142
+ # Set Headers
3143
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3144
+ request_headers['Training-Key'] = api_key unless api_key.nil?
3145
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
3146
+ path_template = 'projects/{projectId}/iterations/{iterationId}'
3147
+
3148
+ request_url = @base_url || self.base_url
3149
+
3150
+ options = {
3151
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3152
+ path_params: {'projectId' => project_id,'iterationId' => iteration_id},
3153
+ headers: request_headers.merge(custom_headers || {}),
3154
+ base_url: request_url
3155
+ }
3156
+ promise = self.make_request_async(:delete, path_template, options)
3157
+
3158
+ promise = promise.then do |result|
3159
+ http_response = result.response
3160
+ status_code = http_response.status
3161
+ response_content = http_response.body
3162
+ unless status_code == 204
3163
+ error_model = JSON.load(response_content)
3164
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3165
+ end
3166
+
3167
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3168
+
3169
+ result
3170
+ end
3171
+
3172
+ promise.execute
3173
+ end
3174
+
3175
+ #
3176
+ # Update a specific iteration
3177
+ #
3178
+ # @param project_id Project id
3179
+ # @param iteration_id Iteration id
3180
+ # @param updated_iteration [Iteration] The updated iteration model
3181
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3182
+ # will be added to the HTTP request.
3183
+ #
3184
+ # @return [Iteration] operation results.
3185
+ #
3186
+ def update_iteration(project_id, iteration_id, updated_iteration, custom_headers:nil)
3187
+ response = update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:custom_headers).value!
3188
+ response.body unless response.nil?
3189
+ end
3190
+
3191
+ #
3192
+ # Update a specific iteration
3193
+ #
3194
+ # @param project_id Project id
3195
+ # @param iteration_id Iteration id
3196
+ # @param updated_iteration [Iteration] The updated iteration model
3197
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3198
+ # will be added to the HTTP request.
3199
+ #
3200
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3201
+ #
3202
+ def update_iteration_with_http_info(project_id, iteration_id, updated_iteration, custom_headers:nil)
3203
+ update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:custom_headers).value!
3204
+ end
3205
+
3206
+ #
3207
+ # Update a specific iteration
3208
+ #
3209
+ # @param project_id Project id
3210
+ # @param iteration_id Iteration id
3211
+ # @param updated_iteration [Iteration] The updated iteration model
3212
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3213
+ # to the HTTP request.
3214
+ #
3215
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3216
+ #
3217
+ def update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:nil)
3218
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
3219
+ fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
3220
+ fail ArgumentError, 'updated_iteration is nil' if updated_iteration.nil?
3221
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
3222
+
3223
+
3224
+ request_headers = {}
3225
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3226
+
3227
+ # Set Headers
3228
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3229
+ request_headers['Training-Key'] = api_key unless api_key.nil?
3230
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
3231
+
3232
+ # Serialize Request
3233
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Iteration.mapper()
3234
+ request_content = self.serialize(request_mapper, updated_iteration)
3235
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
3236
+
3237
+ path_template = 'projects/{projectId}/iterations/{iterationId}'
3238
+
3239
+ request_url = @base_url || self.base_url
3240
+
3241
+ options = {
3242
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3243
+ path_params: {'projectId' => project_id,'iterationId' => iteration_id},
3244
+ body: request_content,
3245
+ headers: request_headers.merge(custom_headers || {}),
3246
+ base_url: request_url
3247
+ }
3248
+ promise = self.make_request_async(:patch, path_template, options)
3249
+
3250
+ promise = promise.then do |result|
3251
+ http_response = result.response
3252
+ status_code = http_response.status
3253
+ response_content = http_response.body
3254
+ unless status_code == 200
3255
+ error_model = JSON.load(response_content)
3256
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3257
+ end
3258
+
3259
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3260
+ # Deserialize Response
3261
+ if status_code == 200
3262
+ begin
3263
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3264
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Iteration.mapper()
3265
+ result.body = self.deserialize(result_mapper, parsed_response)
3266
+ rescue Exception => e
3267
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3268
+ end
3269
+ end
3270
+
3271
+ result
3272
+ end
3273
+
3274
+ promise.execute
3275
+ end
3276
+
3277
+ #
3278
+ # Get detailed performance information about an iteration
3279
+ #
3280
+ # @param project_id The id of the project the iteration belongs to
3281
+ # @param iteration_id The id of the iteration to get
3282
+ # @param threshold [Float] The threshold used to determine true predictions
3283
+ # @param overlap_threshold [Float] If applicable, the bounding box overlap
3284
+ # threshold used to determine true predictions
3285
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3286
+ # will be added to the HTTP request.
3287
+ #
3288
+ # @return [IterationPerformance] operation results.
3289
+ #
3290
+ def get_iteration_performance(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil)
3291
+ response = get_iteration_performance_async(project_id, iteration_id, threshold:threshold, overlap_threshold:overlap_threshold, custom_headers:custom_headers).value!
3292
+ response.body unless response.nil?
3293
+ end
3294
+
3295
+ #
3296
+ # Get detailed performance information about an iteration
3297
+ #
3298
+ # @param project_id The id of the project the iteration belongs to
3299
+ # @param iteration_id The id of the iteration to get
3300
+ # @param threshold [Float] The threshold used to determine true predictions
3301
+ # @param overlap_threshold [Float] If applicable, the bounding box overlap
3302
+ # threshold used to determine true predictions
3303
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3304
+ # will be added to the HTTP request.
3305
+ #
3306
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3307
+ #
3308
+ def get_iteration_performance_with_http_info(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil)
3309
+ get_iteration_performance_async(project_id, iteration_id, threshold:threshold, overlap_threshold:overlap_threshold, custom_headers:custom_headers).value!
3310
+ end
3311
+
3312
+ #
3313
+ # Get detailed performance information about an iteration
3314
+ #
3315
+ # @param project_id The id of the project the iteration belongs to
3316
+ # @param iteration_id The id of the iteration to get
3317
+ # @param threshold [Float] The threshold used to determine true predictions
3318
+ # @param overlap_threshold [Float] If applicable, the bounding box overlap
3319
+ # threshold used to determine true predictions
3320
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3321
+ # to the HTTP request.
3322
+ #
3323
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3324
+ #
3325
+ def get_iteration_performance_async(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil)
3326
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
3327
+ fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
3328
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
3329
+
3330
+
3331
+ request_headers = {}
3332
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3333
+
3334
+ # Set Headers
3335
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3336
+ request_headers['Training-Key'] = api_key unless api_key.nil?
3337
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
3338
+ path_template = 'projects/{projectId}/iterations/{iterationId}/performance'
3339
+
3340
+ request_url = @base_url || self.base_url
3341
+
3342
+ options = {
3343
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3344
+ path_params: {'projectId' => project_id,'iterationId' => iteration_id},
3345
+ query_params: {'threshold' => threshold,'overlapThreshold' => overlap_threshold},
3346
+ headers: request_headers.merge(custom_headers || {}),
3347
+ base_url: request_url
3348
+ }
3349
+ promise = self.make_request_async(:get, path_template, options)
3350
+
3351
+ promise = promise.then do |result|
3352
+ http_response = result.response
3353
+ status_code = http_response.status
3354
+ response_content = http_response.body
3355
+ unless status_code == 200
3356
+ error_model = JSON.load(response_content)
3357
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3358
+ end
3359
+
3360
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3361
+ # Deserialize Response
3362
+ if status_code == 200
3363
+ begin
3364
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3365
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::IterationPerformance.mapper()
3366
+ result.body = self.deserialize(result_mapper, parsed_response)
3367
+ rescue Exception => e
3368
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3369
+ end
3370
+ end
3371
+
3372
+ result
3373
+ end
3374
+
3375
+ promise.execute
3376
+ end
3377
+
3378
+ #
3379
+ # Get image with its prediction for a given project iteration
3380
+ #
3381
+ # This API supports batching and range selection. By default it will only
3382
+ # return first 50 images matching images.
3383
+ # Use the {take} and {skip} parameters to control how many images to return in
3384
+ # a given batch.
3385
+ # The filtering is on an and/or relationship. For example, if the provided tag
3386
+ # ids are for the "Dog" and
3387
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
3388
+ #
3389
+ # @param project_id The project id
3390
+ # @param iteration_id The iteration id. Defaults to workspace
3391
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images.
3392
+ # Defaults to all tagged images when null. Limited to 20
3393
+ # @param order_by [Enum] The ordering. Defaults to newest. Possible values
3394
+ # include: 'Newest', 'Oldest'
3395
+ # @param take [Integer] Maximum number of images to return. Defaults to 50,
3396
+ # limited to 256
3397
+ # @param skip [Integer] Number of images to skip before beginning the image
3398
+ # batch. Defaults to 0
3399
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3400
+ # will be added to the HTTP request.
3401
+ #
3402
+ # @return [Array] operation results.
3403
+ #
3404
+ def get_image_performances(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
3405
+ response = get_image_performances_async(project_id, iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
3406
+ response.body unless response.nil?
3407
+ end
3408
+
3409
+ #
3410
+ # Get image with its prediction for a given project iteration
3411
+ #
3412
+ # This API supports batching and range selection. By default it will only
3413
+ # return first 50 images matching images.
3414
+ # Use the {take} and {skip} parameters to control how many images to return in
3415
+ # a given batch.
3416
+ # The filtering is on an and/or relationship. For example, if the provided tag
3417
+ # ids are for the "Dog" and
3418
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
3419
+ #
3420
+ # @param project_id The project id
3421
+ # @param iteration_id The iteration id. Defaults to workspace
3422
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images.
3423
+ # Defaults to all tagged images when null. Limited to 20
3424
+ # @param order_by [Enum] The ordering. Defaults to newest. Possible values
3425
+ # include: 'Newest', 'Oldest'
3426
+ # @param take [Integer] Maximum number of images to return. Defaults to 50,
3427
+ # limited to 256
3428
+ # @param skip [Integer] Number of images to skip before beginning the image
3429
+ # batch. Defaults to 0
3430
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3431
+ # will be added to the HTTP request.
3432
+ #
3433
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3434
+ #
3435
+ def get_image_performances_with_http_info(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
3436
+ get_image_performances_async(project_id, iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
3437
+ end
3438
+
3439
+ #
3440
+ # Get image with its prediction for a given project iteration
3441
+ #
3442
+ # This API supports batching and range selection. By default it will only
3443
+ # return first 50 images matching images.
3444
+ # Use the {take} and {skip} parameters to control how many images to return in
3445
+ # a given batch.
3446
+ # The filtering is on an and/or relationship. For example, if the provided tag
3447
+ # ids are for the "Dog" and
3448
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
3449
+ #
3450
+ # @param project_id The project id
3451
+ # @param iteration_id The iteration id. Defaults to workspace
3452
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images.
3453
+ # Defaults to all tagged images when null. Limited to 20
3454
+ # @param order_by [Enum] The ordering. Defaults to newest. Possible values
3455
+ # include: 'Newest', 'Oldest'
3456
+ # @param take [Integer] Maximum number of images to return. Defaults to 50,
3457
+ # limited to 256
3458
+ # @param skip [Integer] Number of images to skip before beginning the image
3459
+ # batch. Defaults to 0
3460
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3461
+ # to the HTTP request.
3462
+ #
3463
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3464
+ #
3465
+ def get_image_performances_async(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
3466
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
3467
+ fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
3468
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
3469
+
3470
+
3471
+ request_headers = {}
3472
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3473
+
3474
+ # Set Headers
3475
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3476
+ request_headers['Training-Key'] = api_key unless api_key.nil?
3477
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
3478
+ path_template = 'projects/{projectId}/iterations/{iterationId}/performance/images'
3479
+
3480
+ request_url = @base_url || self.base_url
3481
+
3482
+ options = {
3483
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3484
+ path_params: {'projectId' => project_id,'iterationId' => iteration_id},
3485
+ query_params: {'tagIds' => tag_ids.nil? ? nil : tag_ids.join(','),'orderBy' => order_by,'take' => take,'skip' => skip},
3486
+ headers: request_headers.merge(custom_headers || {}),
3487
+ base_url: request_url
3488
+ }
3489
+ promise = self.make_request_async(:get, path_template, options)
3490
+
3491
+ promise = promise.then do |result|
3492
+ http_response = result.response
3493
+ status_code = http_response.status
3494
+ response_content = http_response.body
3495
+ unless status_code == 200
3496
+ error_model = JSON.load(response_content)
3497
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3498
+ end
3499
+
3500
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3501
+ # Deserialize Response
3502
+ if status_code == 200
3503
+ begin
3504
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3505
+ result_mapper = {
3506
+ client_side_validation: true,
3507
+ required: false,
3508
+ serialized_name: 'parsed_response',
3509
+ type: {
3510
+ name: 'Sequence',
3511
+ element: {
3512
+ client_side_validation: true,
3513
+ required: false,
3514
+ serialized_name: 'ImagePerformanceElementType',
3515
+ type: {
3516
+ name: 'Composite',
3517
+ class_name: 'ImagePerformance'
3518
+ }
3519
+ }
3520
+ }
3521
+ }
3522
+ result.body = self.deserialize(result_mapper, parsed_response)
3523
+ rescue Exception => e
3524
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3525
+ end
3526
+ end
3527
+
3528
+ result
3529
+ end
3530
+
3531
+ promise.execute
3532
+ end
3533
+
3534
+ #
3535
+ # Gets the number of images tagged with the provided {tagIds} that have
3536
+ # prediction results from
3537
+ # training for the provided iteration {iterationId}
3538
+ #
3539
+ # The filtering is on an and/or relationship. For example, if the provided tag
3540
+ # ids are for the "Dog" and
3541
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
3542
+ #
3543
+ # @param project_id The project id
3544
+ # @param iteration_id The iteration id. Defaults to workspace
3545
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images to
3546
+ # count. Defaults to all tags when null.
3547
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3548
+ # will be added to the HTTP request.
3549
+ #
3550
+ # @return [Number] operation results.
3551
+ #
3552
+ def get_image_performance_count(project_id, iteration_id, tag_ids:nil, custom_headers:nil)
3553
+ response = get_image_performance_count_async(project_id, iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
3554
+ response.body unless response.nil?
3555
+ end
3556
+
3557
+ #
3558
+ # Gets the number of images tagged with the provided {tagIds} that have
3559
+ # prediction results from
3560
+ # training for the provided iteration {iterationId}
3561
+ #
3562
+ # The filtering is on an and/or relationship. For example, if the provided tag
3563
+ # ids are for the "Dog" and
3564
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
3565
+ #
3566
+ # @param project_id The project id
3567
+ # @param iteration_id The iteration id. Defaults to workspace
3568
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images to
3569
+ # count. Defaults to all tags when null.
3570
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3571
+ # will be added to the HTTP request.
3572
+ #
3573
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3574
+ #
3575
+ def get_image_performance_count_with_http_info(project_id, iteration_id, tag_ids:nil, custom_headers:nil)
3576
+ get_image_performance_count_async(project_id, iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
3577
+ end
3578
+
3579
+ #
3580
+ # Gets the number of images tagged with the provided {tagIds} that have
3581
+ # prediction results from
3582
+ # training for the provided iteration {iterationId}
3583
+ #
3584
+ # The filtering is on an and/or relationship. For example, if the provided tag
3585
+ # ids are for the "Dog" and
3586
+ # "Cat" tags, then only images tagged with Dog and/or Cat will be returned
3587
+ #
3588
+ # @param project_id The project id
3589
+ # @param iteration_id The iteration id. Defaults to workspace
3590
+ # @param tag_ids [Array<String>] A list of tags ids to filter the images to
3591
+ # count. Defaults to all tags when null.
3592
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3593
+ # to the HTTP request.
3594
+ #
3595
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3596
+ #
3597
+ def get_image_performance_count_async(project_id, iteration_id, tag_ids:nil, custom_headers:nil)
3598
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
3599
+ fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
3600
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
3601
+
3602
+
3603
+ request_headers = {}
3604
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3605
+
3606
+ # Set Headers
3607
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3608
+ request_headers['Training-Key'] = api_key unless api_key.nil?
3609
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
3610
+ path_template = 'projects/{projectId}/iterations/{iterationId}/performance/images/count'
3611
+
3612
+ request_url = @base_url || self.base_url
3613
+
3614
+ options = {
3615
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3616
+ path_params: {'projectId' => project_id,'iterationId' => iteration_id},
3617
+ query_params: {'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')},
3618
+ headers: request_headers.merge(custom_headers || {}),
3619
+ base_url: request_url
3620
+ }
3621
+ promise = self.make_request_async(:get, path_template, options)
3622
+
3623
+ promise = promise.then do |result|
3624
+ http_response = result.response
3625
+ status_code = http_response.status
3626
+ response_content = http_response.body
3627
+ unless status_code == 200
3628
+ error_model = JSON.load(response_content)
3629
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3630
+ end
3631
+
3632
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3633
+ # Deserialize Response
3634
+ if status_code == 200
3635
+ begin
3636
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3637
+ result_mapper = {
3638
+ client_side_validation: true,
3639
+ required: false,
3640
+ serialized_name: 'parsed_response',
3641
+ type: {
3642
+ name: 'Number'
3643
+ }
3644
+ }
3645
+ result.body = self.deserialize(result_mapper, parsed_response)
3646
+ rescue Exception => e
3647
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3648
+ end
3649
+ end
3650
+
3651
+ result
3652
+ end
3653
+
3654
+ promise.execute
3655
+ end
3656
+
3657
+ #
3658
+ # Get the list of exports for a specific iteration
3659
+ #
3660
+ # @param project_id The project id
3661
+ # @param iteration_id The iteration id
3662
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3663
+ # will be added to the HTTP request.
3664
+ #
3665
+ # @return [Array] operation results.
3666
+ #
3667
+ def get_exports(project_id, iteration_id, custom_headers:nil)
3668
+ response = get_exports_async(project_id, iteration_id, custom_headers:custom_headers).value!
3669
+ response.body unless response.nil?
3670
+ end
3671
+
3672
+ #
3673
+ # Get the list of exports for a specific iteration
3674
+ #
3675
+ # @param project_id The project id
3676
+ # @param iteration_id The iteration id
3677
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3678
+ # will be added to the HTTP request.
3679
+ #
3680
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3681
+ #
3682
+ def get_exports_with_http_info(project_id, iteration_id, custom_headers:nil)
3683
+ get_exports_async(project_id, iteration_id, custom_headers:custom_headers).value!
3684
+ end
3685
+
3686
+ #
3687
+ # Get the list of exports for a specific iteration
3688
+ #
3689
+ # @param project_id The project id
3690
+ # @param iteration_id The iteration id
3691
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3692
+ # to the HTTP request.
3693
+ #
3694
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3695
+ #
3696
+ def get_exports_async(project_id, iteration_id, custom_headers:nil)
3697
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
3698
+ fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
3699
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
3700
+
3701
+
3702
+ request_headers = {}
3703
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3704
+
3705
+ # Set Headers
3706
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3707
+ request_headers['Training-Key'] = api_key unless api_key.nil?
3708
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
3709
+ path_template = 'projects/{projectId}/iterations/{iterationId}/export'
3710
+
3711
+ request_url = @base_url || self.base_url
3712
+
3713
+ options = {
3714
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3715
+ path_params: {'projectId' => project_id,'iterationId' => iteration_id},
3716
+ headers: request_headers.merge(custom_headers || {}),
3717
+ base_url: request_url
3718
+ }
3719
+ promise = self.make_request_async(:get, path_template, options)
3720
+
3721
+ promise = promise.then do |result|
3722
+ http_response = result.response
3723
+ status_code = http_response.status
3724
+ response_content = http_response.body
3725
+ unless status_code == 200
3726
+ error_model = JSON.load(response_content)
3727
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3728
+ end
3729
+
3730
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3731
+ # Deserialize Response
3732
+ if status_code == 200
3733
+ begin
3734
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3735
+ result_mapper = {
3736
+ client_side_validation: true,
3737
+ required: false,
3738
+ serialized_name: 'parsed_response',
3739
+ type: {
3740
+ name: 'Sequence',
3741
+ element: {
3742
+ client_side_validation: true,
3743
+ required: false,
3744
+ serialized_name: 'ExportElementType',
3745
+ type: {
3746
+ name: 'Composite',
3747
+ class_name: 'Export'
3748
+ }
3749
+ }
3750
+ }
3751
+ }
3752
+ result.body = self.deserialize(result_mapper, parsed_response)
3753
+ rescue Exception => e
3754
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3755
+ end
3756
+ end
3757
+
3758
+ result
3759
+ end
3760
+
3761
+ promise.execute
3762
+ end
3763
+
3764
+ #
3765
+ # Export a trained iteration
3766
+ #
3767
+ # @param project_id The project id
3768
+ # @param iteration_id The iteration id
3769
+ # @param platform [String] The target platform (coreml or tensorflow)
3770
+ # @param flavor [String] The flavor of the target platform (Windows, Linux,
3771
+ # ARM, or GPU)
3772
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3773
+ # will be added to the HTTP request.
3774
+ #
3775
+ # @return [Export] operation results.
3776
+ #
3777
+ def export_iteration(project_id, iteration_id, platform, flavor:nil, custom_headers:nil)
3778
+ response = export_iteration_async(project_id, iteration_id, platform, flavor:flavor, custom_headers:custom_headers).value!
3779
+ response.body unless response.nil?
3780
+ end
3781
+
3782
+ #
3783
+ # Export a trained iteration
3784
+ #
3785
+ # @param project_id The project id
3786
+ # @param iteration_id The iteration id
3787
+ # @param platform [String] The target platform (coreml or tensorflow)
3788
+ # @param flavor [String] The flavor of the target platform (Windows, Linux,
3789
+ # ARM, or GPU)
3790
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3791
+ # will be added to the HTTP request.
3792
+ #
3793
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3794
+ #
3795
+ def export_iteration_with_http_info(project_id, iteration_id, platform, flavor:nil, custom_headers:nil)
3796
+ export_iteration_async(project_id, iteration_id, platform, flavor:flavor, custom_headers:custom_headers).value!
3797
+ end
3798
+
3799
+ #
3800
+ # Export a trained iteration
3801
+ #
3802
+ # @param project_id The project id
3803
+ # @param iteration_id The iteration id
3804
+ # @param platform [String] The target platform (coreml or tensorflow)
3805
+ # @param flavor [String] The flavor of the target platform (Windows, Linux,
3806
+ # ARM, or GPU)
3807
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3808
+ # to the HTTP request.
3809
+ #
3810
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3811
+ #
3812
+ def export_iteration_async(project_id, iteration_id, platform, flavor:nil, custom_headers:nil)
3813
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
3814
+ fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
3815
+ fail ArgumentError, 'platform is nil' if platform.nil?
3816
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
3817
+
3818
+
3819
+ request_headers = {}
3820
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3821
+
3822
+ # Set Headers
3823
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3824
+ request_headers['Training-Key'] = api_key unless api_key.nil?
3825
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
3826
+ path_template = 'projects/{projectId}/iterations/{iterationId}/export'
3827
+
3828
+ request_url = @base_url || self.base_url
3829
+
3830
+ options = {
3831
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3832
+ path_params: {'projectId' => project_id,'iterationId' => iteration_id},
3833
+ query_params: {'platform' => platform,'flavor' => flavor},
3834
+ headers: request_headers.merge(custom_headers || {}),
3835
+ base_url: request_url
3836
+ }
3837
+ promise = self.make_request_async(:post, path_template, options)
3838
+
3839
+ promise = promise.then do |result|
3840
+ http_response = result.response
3841
+ status_code = http_response.status
3842
+ response_content = http_response.body
3843
+ unless status_code == 200
3844
+ error_model = JSON.load(response_content)
3845
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3846
+ end
3847
+
3848
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3849
+ # Deserialize Response
3850
+ if status_code == 200
3851
+ begin
3852
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3853
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Export.mapper()
3854
+ result.body = self.deserialize(result_mapper, parsed_response)
3855
+ rescue Exception => e
3856
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3857
+ end
3858
+ end
3859
+
3860
+ result
3861
+ end
3862
+
3863
+ promise.execute
3864
+ end
3865
+
3866
+ #
3867
+ # Get information about a specific tag
3868
+ #
3869
+ # @param project_id The project this tag belongs to
3870
+ # @param tag_id The tag id
3871
+ # @param iteration_id The iteration to retrieve this tag from. Optional,
3872
+ # defaults to current training set
3873
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3874
+ # will be added to the HTTP request.
3875
+ #
3876
+ # @return [Tag] operation results.
3877
+ #
3878
+ def get_tag(project_id, tag_id, iteration_id:nil, custom_headers:nil)
3879
+ response = get_tag_async(project_id, tag_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
3880
+ response.body unless response.nil?
3881
+ end
3882
+
3883
+ #
3884
+ # Get information about a specific tag
3885
+ #
3886
+ # @param project_id The project this tag belongs to
3887
+ # @param tag_id The tag id
3888
+ # @param iteration_id The iteration to retrieve this tag from. Optional,
3889
+ # defaults to current training set
3890
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3891
+ # will be added to the HTTP request.
3892
+ #
3893
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3894
+ #
3895
+ def get_tag_with_http_info(project_id, tag_id, iteration_id:nil, custom_headers:nil)
3896
+ get_tag_async(project_id, tag_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
3897
+ end
3898
+
3899
+ #
3900
+ # Get information about a specific tag
3901
+ #
3902
+ # @param project_id The project this tag belongs to
3903
+ # @param tag_id The tag id
3904
+ # @param iteration_id The iteration to retrieve this tag from. Optional,
3905
+ # defaults to current training set
3906
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3907
+ # to the HTTP request.
3908
+ #
3909
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3910
+ #
3911
+ def get_tag_async(project_id, tag_id, iteration_id:nil, custom_headers:nil)
3912
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
3913
+ fail ArgumentError, 'tag_id is nil' if tag_id.nil?
3914
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
3915
+
3916
+
3917
+ request_headers = {}
3918
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3919
+
3920
+ # Set Headers
3921
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3922
+ request_headers['Training-Key'] = api_key unless api_key.nil?
3923
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
3924
+ path_template = 'projects/{projectId}/tags/{tagId}'
3925
+
3926
+ request_url = @base_url || self.base_url
3927
+
3928
+ options = {
3929
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3930
+ path_params: {'projectId' => project_id,'tagId' => tag_id},
3931
+ query_params: {'iterationId' => iteration_id},
3932
+ headers: request_headers.merge(custom_headers || {}),
3933
+ base_url: request_url
3934
+ }
3935
+ promise = self.make_request_async(:get, path_template, options)
3936
+
3937
+ promise = promise.then do |result|
3938
+ http_response = result.response
3939
+ status_code = http_response.status
3940
+ response_content = http_response.body
3941
+ unless status_code == 200
3942
+ error_model = JSON.load(response_content)
3943
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3944
+ end
3945
+
3946
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3947
+ # Deserialize Response
3948
+ if status_code == 200
3949
+ begin
3950
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3951
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Tag.mapper()
3952
+ result.body = self.deserialize(result_mapper, parsed_response)
3953
+ rescue Exception => e
3954
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3955
+ end
3956
+ end
3957
+
3958
+ result
3959
+ end
3960
+
3961
+ promise.execute
3962
+ end
3963
+
3964
+ #
3965
+ # Delete a tag from the project
3966
+ #
3967
+ # @param project_id The project id
3968
+ # @param tag_id Id of the tag to be deleted
3969
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3970
+ # will be added to the HTTP request.
3971
+ #
3972
+ #
3973
+ def delete_tag(project_id, tag_id, custom_headers:nil)
3974
+ response = delete_tag_async(project_id, tag_id, custom_headers:custom_headers).value!
3975
+ nil
3976
+ end
3977
+
3978
+ #
3979
+ # Delete a tag from the project
3980
+ #
3981
+ # @param project_id The project id
3982
+ # @param tag_id Id of the tag to be deleted
3983
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3984
+ # will be added to the HTTP request.
3985
+ #
3986
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3987
+ #
3988
+ def delete_tag_with_http_info(project_id, tag_id, custom_headers:nil)
3989
+ delete_tag_async(project_id, tag_id, custom_headers:custom_headers).value!
3990
+ end
3991
+
3992
+ #
3993
+ # Delete a tag from the project
3994
+ #
3995
+ # @param project_id The project id
3996
+ # @param tag_id Id of the tag to be deleted
3997
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3998
+ # to the HTTP request.
3999
+ #
4000
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4001
+ #
4002
+ def delete_tag_async(project_id, tag_id, custom_headers:nil)
4003
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
4004
+ fail ArgumentError, 'tag_id is nil' if tag_id.nil?
4005
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
4006
+
4007
+
4008
+ request_headers = {}
4009
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4010
+
4011
+ # Set Headers
4012
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
4013
+ request_headers['Training-Key'] = api_key unless api_key.nil?
4014
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
4015
+ path_template = 'projects/{projectId}/tags/{tagId}'
4016
+
4017
+ request_url = @base_url || self.base_url
4018
+
4019
+ options = {
4020
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4021
+ path_params: {'projectId' => project_id,'tagId' => tag_id},
4022
+ headers: request_headers.merge(custom_headers || {}),
4023
+ base_url: request_url
4024
+ }
4025
+ promise = self.make_request_async(:delete, path_template, options)
4026
+
4027
+ promise = promise.then do |result|
4028
+ http_response = result.response
4029
+ status_code = http_response.status
4030
+ response_content = http_response.body
4031
+ unless status_code == 204
4032
+ error_model = JSON.load(response_content)
4033
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
4034
+ end
4035
+
4036
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
4037
+
4038
+ result
4039
+ end
4040
+
4041
+ promise.execute
4042
+ end
4043
+
4044
+ #
4045
+ # Update a tag
4046
+ #
4047
+ # @param project_id The project id
4048
+ # @param tag_id The id of the target tag
4049
+ # @param updated_tag [Tag] The updated tag model
4050
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4051
+ # will be added to the HTTP request.
4052
+ #
4053
+ # @return [Tag] operation results.
4054
+ #
4055
+ def update_tag(project_id, tag_id, updated_tag, custom_headers:nil)
4056
+ response = update_tag_async(project_id, tag_id, updated_tag, custom_headers:custom_headers).value!
4057
+ response.body unless response.nil?
4058
+ end
4059
+
4060
+ #
4061
+ # Update a tag
4062
+ #
4063
+ # @param project_id The project id
4064
+ # @param tag_id The id of the target tag
4065
+ # @param updated_tag [Tag] The updated tag model
4066
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4067
+ # will be added to the HTTP request.
4068
+ #
4069
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
4070
+ #
4071
+ def update_tag_with_http_info(project_id, tag_id, updated_tag, custom_headers:nil)
4072
+ update_tag_async(project_id, tag_id, updated_tag, custom_headers:custom_headers).value!
4073
+ end
4074
+
4075
+ #
4076
+ # Update a tag
4077
+ #
4078
+ # @param project_id The project id
4079
+ # @param tag_id The id of the target tag
4080
+ # @param updated_tag [Tag] The updated tag model
4081
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4082
+ # to the HTTP request.
4083
+ #
4084
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4085
+ #
4086
+ def update_tag_async(project_id, tag_id, updated_tag, custom_headers:nil)
4087
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
4088
+ fail ArgumentError, 'tag_id is nil' if tag_id.nil?
4089
+ fail ArgumentError, 'updated_tag is nil' if updated_tag.nil?
4090
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
4091
+
4092
+
4093
+ request_headers = {}
4094
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4095
+
4096
+ # Set Headers
4097
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
4098
+ request_headers['Training-Key'] = api_key unless api_key.nil?
4099
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
4100
+
4101
+ # Serialize Request
4102
+ request_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Tag.mapper()
4103
+ request_content = self.serialize(request_mapper, updated_tag)
4104
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
4105
+
4106
+ path_template = 'projects/{projectId}/tags/{tagId}'
4107
+
4108
+ request_url = @base_url || self.base_url
4109
+
4110
+ options = {
4111
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4112
+ path_params: {'projectId' => project_id,'tagId' => tag_id},
4113
+ body: request_content,
4114
+ headers: request_headers.merge(custom_headers || {}),
4115
+ base_url: request_url
4116
+ }
4117
+ promise = self.make_request_async(:patch, path_template, options)
4118
+
4119
+ promise = promise.then do |result|
4120
+ http_response = result.response
4121
+ status_code = http_response.status
4122
+ response_content = http_response.body
4123
+ unless status_code == 200
4124
+ error_model = JSON.load(response_content)
4125
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
4126
+ end
4127
+
4128
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
4129
+ # Deserialize Response
4130
+ if status_code == 200
4131
+ begin
4132
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
4133
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Tag.mapper()
4134
+ result.body = self.deserialize(result_mapper, parsed_response)
4135
+ rescue Exception => e
4136
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
4137
+ end
4138
+ end
4139
+
4140
+ result
4141
+ end
4142
+
4143
+ promise.execute
4144
+ end
4145
+
4146
+ #
4147
+ # Get the tags for a given project and iteration
4148
+ #
4149
+ # @param project_id The project id
4150
+ # @param iteration_id The iteration id. Defaults to workspace
4151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4152
+ # will be added to the HTTP request.
4153
+ #
4154
+ # @return [Array] operation results.
4155
+ #
4156
+ def get_tags(project_id, iteration_id:nil, custom_headers:nil)
4157
+ response = get_tags_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
4158
+ response.body unless response.nil?
4159
+ end
4160
+
4161
+ #
4162
+ # Get the tags for a given project and iteration
4163
+ #
4164
+ # @param project_id The project id
4165
+ # @param iteration_id The iteration id. Defaults to workspace
4166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4167
+ # will be added to the HTTP request.
4168
+ #
4169
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
4170
+ #
4171
+ def get_tags_with_http_info(project_id, iteration_id:nil, custom_headers:nil)
4172
+ get_tags_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
4173
+ end
4174
+
4175
+ #
4176
+ # Get the tags for a given project and iteration
4177
+ #
4178
+ # @param project_id The project id
4179
+ # @param iteration_id The iteration id. Defaults to workspace
4180
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4181
+ # to the HTTP request.
4182
+ #
4183
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4184
+ #
4185
+ def get_tags_async(project_id, iteration_id:nil, custom_headers:nil)
4186
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
4187
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
4188
+
4189
+
4190
+ request_headers = {}
4191
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4192
+
4193
+ # Set Headers
4194
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
4195
+ request_headers['Training-Key'] = api_key unless api_key.nil?
4196
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
4197
+ path_template = 'projects/{projectId}/tags'
4198
+
4199
+ request_url = @base_url || self.base_url
4200
+
4201
+ options = {
4202
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4203
+ path_params: {'projectId' => project_id},
4204
+ query_params: {'iterationId' => iteration_id},
4205
+ headers: request_headers.merge(custom_headers || {}),
4206
+ base_url: request_url
4207
+ }
4208
+ promise = self.make_request_async(:get, path_template, options)
4209
+
4210
+ promise = promise.then do |result|
4211
+ http_response = result.response
4212
+ status_code = http_response.status
4213
+ response_content = http_response.body
4214
+ unless status_code == 200
4215
+ error_model = JSON.load(response_content)
4216
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
4217
+ end
4218
+
4219
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
4220
+ # Deserialize Response
4221
+ if status_code == 200
4222
+ begin
4223
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
4224
+ result_mapper = {
4225
+ client_side_validation: true,
4226
+ required: false,
4227
+ serialized_name: 'parsed_response',
4228
+ type: {
4229
+ name: 'Sequence',
4230
+ element: {
4231
+ client_side_validation: true,
4232
+ required: false,
4233
+ serialized_name: 'TagElementType',
4234
+ type: {
4235
+ name: 'Composite',
4236
+ class_name: 'Tag'
4237
+ }
4238
+ }
4239
+ }
4240
+ }
4241
+ result.body = self.deserialize(result_mapper, parsed_response)
4242
+ rescue Exception => e
4243
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
4244
+ end
4245
+ end
4246
+
4247
+ result
4248
+ end
4249
+
4250
+ promise.execute
4251
+ end
4252
+
4253
+ #
4254
+ # Create a tag for the project
4255
+ #
4256
+ # @param project_id The project id
4257
+ # @param name [String] The tag name
4258
+ # @param description [String] Optional description for the tag
4259
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4260
+ # will be added to the HTTP request.
4261
+ #
4262
+ # @return [Tag] operation results.
4263
+ #
4264
+ def create_tag(project_id, name, description:nil, custom_headers:nil)
4265
+ response = create_tag_async(project_id, name, description:description, custom_headers:custom_headers).value!
4266
+ response.body unless response.nil?
4267
+ end
4268
+
4269
+ #
4270
+ # Create a tag for the project
4271
+ #
4272
+ # @param project_id The project id
4273
+ # @param name [String] The tag name
4274
+ # @param description [String] Optional description for the tag
4275
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4276
+ # will be added to the HTTP request.
4277
+ #
4278
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
4279
+ #
4280
+ def create_tag_with_http_info(project_id, name, description:nil, custom_headers:nil)
4281
+ create_tag_async(project_id, name, description:description, custom_headers:custom_headers).value!
4282
+ end
4283
+
4284
+ #
4285
+ # Create a tag for the project
4286
+ #
4287
+ # @param project_id The project id
4288
+ # @param name [String] The tag name
4289
+ # @param description [String] Optional description for the tag
4290
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4291
+ # to the HTTP request.
4292
+ #
4293
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4294
+ #
4295
+ def create_tag_async(project_id, name, description:nil, custom_headers:nil)
4296
+ fail ArgumentError, 'project_id is nil' if project_id.nil?
4297
+ fail ArgumentError, 'name is nil' if name.nil?
4298
+ fail ArgumentError, 'api_key is nil' if api_key.nil?
4299
+
4300
+
4301
+ request_headers = {}
4302
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4303
+
4304
+ # Set Headers
4305
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
4306
+ request_headers['Training-Key'] = api_key unless api_key.nil?
4307
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
4308
+ path_template = 'projects/{projectId}/tags'
4309
+
4310
+ request_url = @base_url || self.base_url
4311
+
4312
+ options = {
4313
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4314
+ path_params: {'projectId' => project_id},
4315
+ query_params: {'name' => name,'description' => description},
4316
+ headers: request_headers.merge(custom_headers || {}),
4317
+ base_url: request_url
4318
+ }
4319
+ promise = self.make_request_async(:post, path_template, options)
4320
+
4321
+ promise = promise.then do |result|
4322
+ http_response = result.response
4323
+ status_code = http_response.status
4324
+ response_content = http_response.body
4325
+ unless status_code == 200
4326
+ error_model = JSON.load(response_content)
4327
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
4328
+ end
4329
+
4330
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
4331
+ # Deserialize Response
4332
+ if status_code == 200
4333
+ begin
4334
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
4335
+ result_mapper = Azure::CognitiveServices::Customvisiontraining::V2_0::Models::Tag.mapper()
4336
+ result.body = self.deserialize(result_mapper, parsed_response)
4337
+ rescue Exception => e
4338
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
4339
+ end
4340
+ end
4341
+
4342
+ result
4343
+ end
4344
+
4345
+ promise.execute
4346
+ end
4347
+
4348
+
4349
+ private
4350
+ #
4351
+ # Adds telemetry information.
4352
+ #
4353
+ def add_telemetry
4354
+ sdk_information = 'azure_cognitiveservices_customvisiontraining'
4355
+ sdk_information = "#{sdk_information}/0.17.0"
4356
+ add_user_agent_information(sdk_information)
4357
+ end
4358
+ end
4359
+ end