azure_cognitiveservices_customvisiontraining 0.17.0

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