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