azure_mgmt_customer_insights 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_customer_insights.rb +6 -0
  4. data/lib/generated/azure_mgmt_customer_insights.rb +144 -0
  5. data/lib/generated/azure_mgmt_customer_insights/authorization_policies.rb +634 -0
  6. data/lib/generated/azure_mgmt_customer_insights/connector_mappings.rb +548 -0
  7. data/lib/generated/azure_mgmt_customer_insights/connectors.rb +606 -0
  8. data/lib/generated/azure_mgmt_customer_insights/customer_insights_management_client.rb +191 -0
  9. data/lib/generated/azure_mgmt_customer_insights/hubs.rb +841 -0
  10. data/lib/generated/azure_mgmt_customer_insights/images.rb +242 -0
  11. data/lib/generated/azure_mgmt_customer_insights/interactions.rb +591 -0
  12. data/lib/generated/azure_mgmt_customer_insights/kpi.rb +689 -0
  13. data/lib/generated/azure_mgmt_customer_insights/links.rb +565 -0
  14. data/lib/generated/azure_mgmt_customer_insights/models/assignment_principal.rb +71 -0
  15. data/lib/generated/azure_mgmt_customer_insights/models/authorization_policy.rb +87 -0
  16. data/lib/generated/azure_mgmt_customer_insights/models/authorization_policy_list_result.rb +95 -0
  17. data/lib/generated/azure_mgmt_customer_insights/models/authorization_policy_resource_format.rb +111 -0
  18. data/lib/generated/azure_mgmt_customer_insights/models/azure_blob_connector_properties.rb +44 -0
  19. data/lib/generated/azure_mgmt_customer_insights/models/calculation_window_types.rb +19 -0
  20. data/lib/generated/azure_mgmt_customer_insights/models/canonical_profile_definition.rb +63 -0
  21. data/lib/generated/azure_mgmt_customer_insights/models/canonical_profile_definition_properties_item.rb +86 -0
  22. data/lib/generated/azure_mgmt_customer_insights/models/canonical_property_value_type.rb +18 -0
  23. data/lib/generated/azure_mgmt_customer_insights/models/cardinality_types.rb +17 -0
  24. data/lib/generated/azure_mgmt_customer_insights/models/completion_operation_types.rb +17 -0
  25. data/lib/generated/azure_mgmt_customer_insights/models/connector_list_result.rb +94 -0
  26. data/lib/generated/azure_mgmt_customer_insights/models/connector_mapping_availability.rb +56 -0
  27. data/lib/generated/azure_mgmt_customer_insights/models/connector_mapping_complete_operation.rb +57 -0
  28. data/lib/generated/azure_mgmt_customer_insights/models/connector_mapping_error_management.rb +57 -0
  29. data/lib/generated/azure_mgmt_customer_insights/models/connector_mapping_format.rb +97 -0
  30. data/lib/generated/azure_mgmt_customer_insights/models/connector_mapping_list_result.rb +95 -0
  31. data/lib/generated/azure_mgmt_customer_insights/models/connector_mapping_properties.rb +131 -0
  32. data/lib/generated/azure_mgmt_customer_insights/models/connector_mapping_resource_format.rb +226 -0
  33. data/lib/generated/azure_mgmt_customer_insights/models/connector_mapping_states.rb +21 -0
  34. data/lib/generated/azure_mgmt_customer_insights/models/connector_mapping_structure.rb +74 -0
  35. data/lib/generated/azure_mgmt_customer_insights/models/connector_resource_format.rb +183 -0
  36. data/lib/generated/azure_mgmt_customer_insights/models/connector_states.rb +20 -0
  37. data/lib/generated/azure_mgmt_customer_insights/models/connector_types.rb +20 -0
  38. data/lib/generated/azure_mgmt_customer_insights/models/crm_connector_entities.rb +64 -0
  39. data/lib/generated/azure_mgmt_customer_insights/models/crm_connector_properties.rb +93 -0
  40. data/lib/generated/azure_mgmt_customer_insights/models/data_source_precedence.rb +102 -0
  41. data/lib/generated/azure_mgmt_customer_insights/models/data_source_type.rb +17 -0
  42. data/lib/generated/azure_mgmt_customer_insights/models/enriching_kpi.rb +229 -0
  43. data/lib/generated/azure_mgmt_customer_insights/models/entity_type.rb +18 -0
  44. data/lib/generated/azure_mgmt_customer_insights/models/entity_type_definition.rb +243 -0
  45. data/lib/generated/azure_mgmt_customer_insights/models/entity_types.rb +18 -0
  46. data/lib/generated/azure_mgmt_customer_insights/models/error_management_types.rb +17 -0
  47. data/lib/generated/azure_mgmt_customer_insights/models/frequency_types.rb +19 -0
  48. data/lib/generated/azure_mgmt_customer_insights/models/get_image_upload_url_input.rb +64 -0
  49. data/lib/generated/azure_mgmt_customer_insights/models/hub.rb +135 -0
  50. data/lib/generated/azure_mgmt_customer_insights/models/hub_billing_info_format.rb +74 -0
  51. data/lib/generated/azure_mgmt_customer_insights/models/hub_list_result.rb +94 -0
  52. data/lib/generated/azure_mgmt_customer_insights/models/image_definition.rb +64 -0
  53. data/lib/generated/azure_mgmt_customer_insights/models/instance_operation_type.rb +16 -0
  54. data/lib/generated/azure_mgmt_customer_insights/models/interaction_list_result.rb +95 -0
  55. data/lib/generated/azure_mgmt_customer_insights/models/interaction_resource_format.rb +434 -0
  56. data/lib/generated/azure_mgmt_customer_insights/models/kpi_alias.rb +54 -0
  57. data/lib/generated/azure_mgmt_customer_insights/models/kpi_definition.rb +293 -0
  58. data/lib/generated/azure_mgmt_customer_insights/models/kpi_extract.rb +54 -0
  59. data/lib/generated/azure_mgmt_customer_insights/models/kpi_functions.rb +22 -0
  60. data/lib/generated/azure_mgmt_customer_insights/models/kpi_group_by_metadata.rb +71 -0
  61. data/lib/generated/azure_mgmt_customer_insights/models/kpi_list_result.rb +94 -0
  62. data/lib/generated/azure_mgmt_customer_insights/models/kpi_participant_profiles_metadata.rb +44 -0
  63. data/lib/generated/azure_mgmt_customer_insights/models/kpi_resource_format.rb +317 -0
  64. data/lib/generated/azure_mgmt_customer_insights/models/kpi_thresholds.rb +64 -0
  65. data/lib/generated/azure_mgmt_customer_insights/models/link_list_result.rb +94 -0
  66. data/lib/generated/azure_mgmt_customer_insights/models/link_resource_format.rb +235 -0
  67. data/lib/generated/azure_mgmt_customer_insights/models/link_types.rb +16 -0
  68. data/lib/generated/azure_mgmt_customer_insights/models/metadata_definition_base.rb +152 -0
  69. data/lib/generated/azure_mgmt_customer_insights/models/participant.rb +117 -0
  70. data/lib/generated/azure_mgmt_customer_insights/models/participant_profile_property_reference.rb +56 -0
  71. data/lib/generated/azure_mgmt_customer_insights/models/participant_property_reference.rb +54 -0
  72. data/lib/generated/azure_mgmt_customer_insights/models/permission_types.rb +17 -0
  73. data/lib/generated/azure_mgmt_customer_insights/models/prediction_distribution_definition.rb +73 -0
  74. data/lib/generated/azure_mgmt_customer_insights/models/prediction_distribution_definition_distributions_item.rb +85 -0
  75. data/lib/generated/azure_mgmt_customer_insights/models/prediction_grades_item.rb +64 -0
  76. data/lib/generated/azure_mgmt_customer_insights/models/prediction_list_result.rb +95 -0
  77. data/lib/generated/azure_mgmt_customer_insights/models/prediction_mappings.rb +64 -0
  78. data/lib/generated/azure_mgmt_customer_insights/models/prediction_model_life_cycle.rb +32 -0
  79. data/lib/generated/azure_mgmt_customer_insights/models/prediction_model_status.rb +161 -0
  80. data/lib/generated/azure_mgmt_customer_insights/models/prediction_resource_format.rb +279 -0
  81. data/lib/generated/azure_mgmt_customer_insights/models/prediction_system_generated_entities.rb +85 -0
  82. data/lib/generated/azure_mgmt_customer_insights/models/prediction_training_results.rb +98 -0
  83. data/lib/generated/azure_mgmt_customer_insights/models/profile_enum_valid_values_format.rb +61 -0
  84. data/lib/generated/azure_mgmt_customer_insights/models/profile_list_result.rb +94 -0
  85. data/lib/generated/azure_mgmt_customer_insights/models/profile_resource_format.rb +312 -0
  86. data/lib/generated/azure_mgmt_customer_insights/models/property_definition.rb +218 -0
  87. data/lib/generated/azure_mgmt_customer_insights/models/provisioning_states.rb +20 -0
  88. data/lib/generated/azure_mgmt_customer_insights/models/proxy_resource.rb +67 -0
  89. data/lib/generated/azure_mgmt_customer_insights/models/relationship_link_field_mapping.rb +66 -0
  90. data/lib/generated/azure_mgmt_customer_insights/models/relationship_link_list_result.rb +95 -0
  91. data/lib/generated/azure_mgmt_customer_insights/models/relationship_link_resource_format.rb +218 -0
  92. data/lib/generated/azure_mgmt_customer_insights/models/relationship_list_result.rb +95 -0
  93. data/lib/generated/azure_mgmt_customer_insights/models/relationship_resource_format.rb +219 -0
  94. data/lib/generated/azure_mgmt_customer_insights/models/relationship_type_field_mapping.rb +55 -0
  95. data/lib/generated/azure_mgmt_customer_insights/models/relationship_type_mapping.rb +55 -0
  96. data/lib/generated/azure_mgmt_customer_insights/models/relationships_lookup.rb +107 -0
  97. data/lib/generated/azure_mgmt_customer_insights/models/resource.rb +94 -0
  98. data/lib/generated/azure_mgmt_customer_insights/models/resource_set_description.rb +69 -0
  99. data/lib/generated/azure_mgmt_customer_insights/models/role_assignment_list_result.rb +95 -0
  100. data/lib/generated/azure_mgmt_customer_insights/models/role_assignment_resource_format.rb +306 -0
  101. data/lib/generated/azure_mgmt_customer_insights/models/role_list_result.rb +94 -0
  102. data/lib/generated/azure_mgmt_customer_insights/models/role_resource_format.rb +78 -0
  103. data/lib/generated/azure_mgmt_customer_insights/models/role_types.rb +20 -0
  104. data/lib/generated/azure_mgmt_customer_insights/models/salesforce_connector_properties.rb +63 -0
  105. data/lib/generated/azure_mgmt_customer_insights/models/salesforce_discover_setting.rb +44 -0
  106. data/lib/generated/azure_mgmt_customer_insights/models/salesforce_table.rb +84 -0
  107. data/lib/generated/azure_mgmt_customer_insights/models/status.rb +17 -0
  108. data/lib/generated/azure_mgmt_customer_insights/models/strong_id.rb +95 -0
  109. data/lib/generated/azure_mgmt_customer_insights/models/suggest_relationship_links_response.rb +65 -0
  110. data/lib/generated/azure_mgmt_customer_insights/models/type_properties_mapping.rb +66 -0
  111. data/lib/generated/azure_mgmt_customer_insights/models/view_list_result.rb +94 -0
  112. data/lib/generated/azure_mgmt_customer_insights/models/view_resource_format.rb +139 -0
  113. data/lib/generated/azure_mgmt_customer_insights/models/widget_type_list_result.rb +95 -0
  114. data/lib/generated/azure_mgmt_customer_insights/models/widget_type_resource_format.rb +160 -0
  115. data/lib/generated/azure_mgmt_customer_insights/module_definition.rb +8 -0
  116. data/lib/generated/azure_mgmt_customer_insights/predictions.rb +896 -0
  117. data/lib/generated/azure_mgmt_customer_insights/profiles.rb +733 -0
  118. data/lib/generated/azure_mgmt_customer_insights/relationship_links.rb +610 -0
  119. data/lib/generated/azure_mgmt_customer_insights/relationships.rb +606 -0
  120. data/lib/generated/azure_mgmt_customer_insights/role_assignments.rb +566 -0
  121. data/lib/generated/azure_mgmt_customer_insights/roles.rb +227 -0
  122. data/lib/generated/azure_mgmt_customer_insights/version.rb +8 -0
  123. data/lib/generated/azure_mgmt_customer_insights/views.rb +530 -0
  124. data/lib/generated/azure_mgmt_customer_insights/widget_types.rb +323 -0
  125. metadata +236 -0
@@ -0,0 +1,8 @@
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 end
7
+ module Azure::ARM end
8
+ module Azure::ARM::CustomerInsights end
@@ -0,0 +1,896 @@
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::ARM::CustomerInsights
7
+ #
8
+ # The Azure Customer Insights management API provides a RESTful set of web
9
+ # services that interact with Azure Customer Insights service to manage your
10
+ # resources. The API has entities that capture the relationship between an
11
+ # end user and the Azure Customer Insights service.
12
+ #
13
+ class Predictions
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Predictions class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [CustomerInsightsManagementClient] reference to the CustomerInsightsManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Creates a Prediction or updates an existing Prediction in the hub.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group.
31
+ # @param hub_name [String] The name of the hub.
32
+ # @param prediction_name [String] The name of the Prediction.
33
+ # @param parameters [PredictionResourceFormat] Parameters supplied to the
34
+ # create/update Prediction operation.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [PredictionResourceFormat] operation results.
39
+ #
40
+ def create_or_update(resource_group_name, hub_name, prediction_name, parameters, custom_headers = nil)
41
+ response = create_or_update_async(resource_group_name, hub_name, prediction_name, parameters, custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # @param resource_group_name [String] The name of the resource group.
47
+ # @param hub_name [String] The name of the hub.
48
+ # @param prediction_name [String] The name of the Prediction.
49
+ # @param parameters [PredictionResourceFormat] Parameters supplied to the
50
+ # create/update Prediction operation.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [Concurrent::Promise] promise which provides async access to http
55
+ # response.
56
+ #
57
+ def create_or_update_async(resource_group_name, hub_name, prediction_name, parameters, custom_headers = nil)
58
+ # Send request
59
+ promise = begin_create_or_update_async(resource_group_name, hub_name, prediction_name, parameters, custom_headers)
60
+
61
+ promise = promise.then do |response|
62
+ # Defining deserialization method.
63
+ deserialize_method = lambda do |parsed_response|
64
+ result_mapper = Azure::ARM::CustomerInsights::Models::PredictionResourceFormat.mapper()
65
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
66
+ end
67
+
68
+ # Waiting for response.
69
+ @client.get_long_running_operation_result(response, deserialize_method)
70
+ end
71
+
72
+ promise
73
+ end
74
+
75
+ #
76
+ # Gets a Prediction in the hub.
77
+ #
78
+ # @param resource_group_name [String] The name of the resource group.
79
+ # @param hub_name [String] The name of the hub.
80
+ # @param prediction_name [String] The name of the Prediction.
81
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
82
+ # will be added to the HTTP request.
83
+ #
84
+ # @return [PredictionResourceFormat] operation results.
85
+ #
86
+ def get(resource_group_name, hub_name, prediction_name, custom_headers = nil)
87
+ response = get_async(resource_group_name, hub_name, prediction_name, custom_headers).value!
88
+ response.body unless response.nil?
89
+ end
90
+
91
+ #
92
+ # Gets a Prediction in the hub.
93
+ #
94
+ # @param resource_group_name [String] The name of the resource group.
95
+ # @param hub_name [String] The name of the hub.
96
+ # @param prediction_name [String] The name of the Prediction.
97
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
98
+ # will be added to the HTTP request.
99
+ #
100
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
101
+ #
102
+ def get_with_http_info(resource_group_name, hub_name, prediction_name, custom_headers = nil)
103
+ get_async(resource_group_name, hub_name, prediction_name, custom_headers).value!
104
+ end
105
+
106
+ #
107
+ # Gets a Prediction in the hub.
108
+ #
109
+ # @param resource_group_name [String] The name of the resource group.
110
+ # @param hub_name [String] The name of the hub.
111
+ # @param prediction_name [String] The name of the Prediction.
112
+ # @param [Hash{String => String}] A hash of custom headers that will be added
113
+ # to the HTTP request.
114
+ #
115
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
116
+ #
117
+ def get_async(resource_group_name, hub_name, prediction_name, custom_headers = nil)
118
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
119
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
120
+ fail ArgumentError, 'prediction_name is nil' if prediction_name.nil?
121
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
122
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
123
+
124
+
125
+ request_headers = {}
126
+
127
+ # Set Headers
128
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
129
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
130
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/predictions/{predictionName}'
131
+
132
+ request_url = @base_url || @client.base_url
133
+
134
+ options = {
135
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
136
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'predictionName' => prediction_name,'subscriptionId' => @client.subscription_id},
137
+ query_params: {'api-version' => @client.api_version},
138
+ headers: request_headers.merge(custom_headers || {}),
139
+ base_url: request_url
140
+ }
141
+ promise = @client.make_request_async(:get, path_template, options)
142
+
143
+ promise = promise.then do |result|
144
+ http_response = result.response
145
+ status_code = http_response.status
146
+ response_content = http_response.body
147
+ unless status_code == 200
148
+ error_model = JSON.load(response_content)
149
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
150
+ end
151
+
152
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
153
+ # Deserialize Response
154
+ if status_code == 200
155
+ begin
156
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
157
+ result_mapper = Azure::ARM::CustomerInsights::Models::PredictionResourceFormat.mapper()
158
+ result.body = @client.deserialize(result_mapper, parsed_response)
159
+ rescue Exception => e
160
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
161
+ end
162
+ end
163
+
164
+ result
165
+ end
166
+
167
+ promise.execute
168
+ end
169
+
170
+ #
171
+ # Deletes a Prediction in the hub.
172
+ #
173
+ # @param resource_group_name [String] The name of the resource group.
174
+ # @param hub_name [String] The name of the hub.
175
+ # @param prediction_name [String] The name of the Prediction.
176
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
177
+ # will be added to the HTTP request.
178
+ #
179
+ def delete(resource_group_name, hub_name, prediction_name, custom_headers = nil)
180
+ response = delete_async(resource_group_name, hub_name, prediction_name, custom_headers).value!
181
+ nil
182
+ end
183
+
184
+ #
185
+ # @param resource_group_name [String] The name of the resource group.
186
+ # @param hub_name [String] The name of the hub.
187
+ # @param prediction_name [String] The name of the Prediction.
188
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
189
+ # will be added to the HTTP request.
190
+ #
191
+ # @return [Concurrent::Promise] promise which provides async access to http
192
+ # response.
193
+ #
194
+ def delete_async(resource_group_name, hub_name, prediction_name, custom_headers = nil)
195
+ # Send request
196
+ promise = begin_delete_async(resource_group_name, hub_name, prediction_name, custom_headers)
197
+
198
+ promise = promise.then do |response|
199
+ # Defining deserialization method.
200
+ deserialize_method = lambda do |parsed_response|
201
+ end
202
+
203
+ # Waiting for response.
204
+ @client.get_long_running_operation_result(response, deserialize_method)
205
+ end
206
+
207
+ promise
208
+ end
209
+
210
+ #
211
+ # Gets training results.
212
+ #
213
+ # @param resource_group_name [String] The name of the resource group.
214
+ # @param hub_name [String] The name of the hub.
215
+ # @param prediction_name [String] The name of the Prediction.
216
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
217
+ # will be added to the HTTP request.
218
+ #
219
+ # @return [PredictionTrainingResults] operation results.
220
+ #
221
+ def get_training_results(resource_group_name, hub_name, prediction_name, custom_headers = nil)
222
+ response = get_training_results_async(resource_group_name, hub_name, prediction_name, custom_headers).value!
223
+ response.body unless response.nil?
224
+ end
225
+
226
+ #
227
+ # Gets training results.
228
+ #
229
+ # @param resource_group_name [String] The name of the resource group.
230
+ # @param hub_name [String] The name of the hub.
231
+ # @param prediction_name [String] The name of the Prediction.
232
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
233
+ # will be added to the HTTP request.
234
+ #
235
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
236
+ #
237
+ def get_training_results_with_http_info(resource_group_name, hub_name, prediction_name, custom_headers = nil)
238
+ get_training_results_async(resource_group_name, hub_name, prediction_name, custom_headers).value!
239
+ end
240
+
241
+ #
242
+ # Gets training results.
243
+ #
244
+ # @param resource_group_name [String] The name of the resource group.
245
+ # @param hub_name [String] The name of the hub.
246
+ # @param prediction_name [String] The name of the Prediction.
247
+ # @param [Hash{String => String}] A hash of custom headers that will be added
248
+ # to the HTTP request.
249
+ #
250
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
251
+ #
252
+ def get_training_results_async(resource_group_name, hub_name, prediction_name, custom_headers = nil)
253
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
254
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
255
+ fail ArgumentError, 'prediction_name is nil' if prediction_name.nil?
256
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
257
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
258
+
259
+
260
+ request_headers = {}
261
+
262
+ # Set Headers
263
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
264
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
265
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/predictions/{predictionName}/getTrainingResults'
266
+
267
+ request_url = @base_url || @client.base_url
268
+
269
+ options = {
270
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
271
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'predictionName' => prediction_name,'subscriptionId' => @client.subscription_id},
272
+ query_params: {'api-version' => @client.api_version},
273
+ headers: request_headers.merge(custom_headers || {}),
274
+ base_url: request_url
275
+ }
276
+ promise = @client.make_request_async(:post, path_template, options)
277
+
278
+ promise = promise.then do |result|
279
+ http_response = result.response
280
+ status_code = http_response.status
281
+ response_content = http_response.body
282
+ unless status_code == 200
283
+ error_model = JSON.load(response_content)
284
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
285
+ end
286
+
287
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
288
+ # Deserialize Response
289
+ if status_code == 200
290
+ begin
291
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
292
+ result_mapper = Azure::ARM::CustomerInsights::Models::PredictionTrainingResults.mapper()
293
+ result.body = @client.deserialize(result_mapper, parsed_response)
294
+ rescue Exception => e
295
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
296
+ end
297
+ end
298
+
299
+ result
300
+ end
301
+
302
+ promise.execute
303
+ end
304
+
305
+ #
306
+ # Gets model status of the prediction.
307
+ #
308
+ # @param resource_group_name [String] The name of the resource group.
309
+ # @param hub_name [String] The name of the hub.
310
+ # @param prediction_name [String] The name of the Prediction.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [PredictionModelStatus] operation results.
315
+ #
316
+ def get_model_status(resource_group_name, hub_name, prediction_name, custom_headers = nil)
317
+ response = get_model_status_async(resource_group_name, hub_name, prediction_name, custom_headers).value!
318
+ response.body unless response.nil?
319
+ end
320
+
321
+ #
322
+ # Gets model status of the prediction.
323
+ #
324
+ # @param resource_group_name [String] The name of the resource group.
325
+ # @param hub_name [String] The name of the hub.
326
+ # @param prediction_name [String] The name of the Prediction.
327
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
328
+ # will be added to the HTTP request.
329
+ #
330
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
331
+ #
332
+ def get_model_status_with_http_info(resource_group_name, hub_name, prediction_name, custom_headers = nil)
333
+ get_model_status_async(resource_group_name, hub_name, prediction_name, custom_headers).value!
334
+ end
335
+
336
+ #
337
+ # Gets model status of the prediction.
338
+ #
339
+ # @param resource_group_name [String] The name of the resource group.
340
+ # @param hub_name [String] The name of the hub.
341
+ # @param prediction_name [String] The name of the Prediction.
342
+ # @param [Hash{String => String}] A hash of custom headers that will be added
343
+ # to the HTTP request.
344
+ #
345
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
346
+ #
347
+ def get_model_status_async(resource_group_name, hub_name, prediction_name, custom_headers = nil)
348
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
349
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
350
+ fail ArgumentError, 'prediction_name is nil' if prediction_name.nil?
351
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
352
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
353
+
354
+
355
+ request_headers = {}
356
+
357
+ # Set Headers
358
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
359
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
360
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/predictions/{predictionName}/getModelStatus'
361
+
362
+ request_url = @base_url || @client.base_url
363
+
364
+ options = {
365
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
366
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'predictionName' => prediction_name,'subscriptionId' => @client.subscription_id},
367
+ query_params: {'api-version' => @client.api_version},
368
+ headers: request_headers.merge(custom_headers || {}),
369
+ base_url: request_url
370
+ }
371
+ promise = @client.make_request_async(:post, path_template, options)
372
+
373
+ promise = promise.then do |result|
374
+ http_response = result.response
375
+ status_code = http_response.status
376
+ response_content = http_response.body
377
+ unless status_code == 200
378
+ error_model = JSON.load(response_content)
379
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
380
+ end
381
+
382
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
383
+ # Deserialize Response
384
+ if status_code == 200
385
+ begin
386
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
387
+ result_mapper = Azure::ARM::CustomerInsights::Models::PredictionModelStatus.mapper()
388
+ result.body = @client.deserialize(result_mapper, parsed_response)
389
+ rescue Exception => e
390
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
391
+ end
392
+ end
393
+
394
+ result
395
+ end
396
+
397
+ promise.execute
398
+ end
399
+
400
+ #
401
+ # Creates or updates the model status of prediction.
402
+ #
403
+ # @param resource_group_name [String] The name of the resource group.
404
+ # @param hub_name [String] The name of the hub.
405
+ # @param prediction_name [String] The name of the Prediction.
406
+ # @param parameters [PredictionModelStatus] Parameters supplied to the
407
+ # create/update prediction model status operation.
408
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
409
+ # will be added to the HTTP request.
410
+ #
411
+ #
412
+ def model_status(resource_group_name, hub_name, prediction_name, parameters, custom_headers = nil)
413
+ response = model_status_async(resource_group_name, hub_name, prediction_name, parameters, custom_headers).value!
414
+ nil
415
+ end
416
+
417
+ #
418
+ # Creates or updates the model status of prediction.
419
+ #
420
+ # @param resource_group_name [String] The name of the resource group.
421
+ # @param hub_name [String] The name of the hub.
422
+ # @param prediction_name [String] The name of the Prediction.
423
+ # @param parameters [PredictionModelStatus] Parameters supplied to the
424
+ # create/update prediction model status operation.
425
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
426
+ # will be added to the HTTP request.
427
+ #
428
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
429
+ #
430
+ def model_status_with_http_info(resource_group_name, hub_name, prediction_name, parameters, custom_headers = nil)
431
+ model_status_async(resource_group_name, hub_name, prediction_name, parameters, custom_headers).value!
432
+ end
433
+
434
+ #
435
+ # Creates or updates the model status of prediction.
436
+ #
437
+ # @param resource_group_name [String] The name of the resource group.
438
+ # @param hub_name [String] The name of the hub.
439
+ # @param prediction_name [String] The name of the Prediction.
440
+ # @param parameters [PredictionModelStatus] Parameters supplied to the
441
+ # create/update prediction model status operation.
442
+ # @param [Hash{String => String}] A hash of custom headers that will be added
443
+ # to the HTTP request.
444
+ #
445
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
446
+ #
447
+ def model_status_async(resource_group_name, hub_name, prediction_name, parameters, custom_headers = nil)
448
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
449
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
450
+ fail ArgumentError, 'prediction_name is nil' if prediction_name.nil?
451
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
452
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
453
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
454
+
455
+
456
+ request_headers = {}
457
+
458
+ # Set Headers
459
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
460
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
461
+
462
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
463
+
464
+ # Serialize Request
465
+ request_mapper = Azure::ARM::CustomerInsights::Models::PredictionModelStatus.mapper()
466
+ request_content = @client.serialize(request_mapper, parameters)
467
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
468
+
469
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/predictions/{predictionName}/modelStatus'
470
+
471
+ request_url = @base_url || @client.base_url
472
+
473
+ options = {
474
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
475
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'predictionName' => prediction_name,'subscriptionId' => @client.subscription_id},
476
+ query_params: {'api-version' => @client.api_version},
477
+ body: request_content,
478
+ headers: request_headers.merge(custom_headers || {}),
479
+ base_url: request_url
480
+ }
481
+ promise = @client.make_request_async(:post, path_template, options)
482
+
483
+ promise = promise.then do |result|
484
+ http_response = result.response
485
+ status_code = http_response.status
486
+ response_content = http_response.body
487
+ unless status_code == 200
488
+ error_model = JSON.load(response_content)
489
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
490
+ end
491
+
492
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
493
+
494
+ result
495
+ end
496
+
497
+ promise.execute
498
+ end
499
+
500
+ #
501
+ # Gets all the predictions in the specified hub.
502
+ #
503
+ # @param resource_group_name [String] The name of the resource group.
504
+ # @param hub_name [String] The name of the hub.
505
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
506
+ # will be added to the HTTP request.
507
+ #
508
+ # @return [Array<PredictionResourceFormat>] operation results.
509
+ #
510
+ def list_by_hub(resource_group_name, hub_name, custom_headers = nil)
511
+ first_page = list_by_hub_as_lazy(resource_group_name, hub_name, custom_headers)
512
+ first_page.get_all_items
513
+ end
514
+
515
+ #
516
+ # Gets all the predictions in the specified hub.
517
+ #
518
+ # @param resource_group_name [String] The name of the resource group.
519
+ # @param hub_name [String] The name of the hub.
520
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
521
+ # will be added to the HTTP request.
522
+ #
523
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
524
+ #
525
+ def list_by_hub_with_http_info(resource_group_name, hub_name, custom_headers = nil)
526
+ list_by_hub_async(resource_group_name, hub_name, custom_headers).value!
527
+ end
528
+
529
+ #
530
+ # Gets all the predictions in the specified hub.
531
+ #
532
+ # @param resource_group_name [String] The name of the resource group.
533
+ # @param hub_name [String] The name of the hub.
534
+ # @param [Hash{String => String}] A hash of custom headers that will be added
535
+ # to the HTTP request.
536
+ #
537
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
538
+ #
539
+ def list_by_hub_async(resource_group_name, hub_name, custom_headers = nil)
540
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
541
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
542
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
543
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
544
+
545
+
546
+ request_headers = {}
547
+
548
+ # Set Headers
549
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
550
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
551
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/predictions'
552
+
553
+ request_url = @base_url || @client.base_url
554
+
555
+ options = {
556
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
557
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'subscriptionId' => @client.subscription_id},
558
+ query_params: {'api-version' => @client.api_version},
559
+ headers: request_headers.merge(custom_headers || {}),
560
+ base_url: request_url
561
+ }
562
+ promise = @client.make_request_async(:get, path_template, options)
563
+
564
+ promise = promise.then do |result|
565
+ http_response = result.response
566
+ status_code = http_response.status
567
+ response_content = http_response.body
568
+ unless status_code == 200
569
+ error_model = JSON.load(response_content)
570
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
571
+ end
572
+
573
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
574
+ # Deserialize Response
575
+ if status_code == 200
576
+ begin
577
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
578
+ result_mapper = Azure::ARM::CustomerInsights::Models::PredictionListResult.mapper()
579
+ result.body = @client.deserialize(result_mapper, parsed_response)
580
+ rescue Exception => e
581
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
582
+ end
583
+ end
584
+
585
+ result
586
+ end
587
+
588
+ promise.execute
589
+ end
590
+
591
+ #
592
+ # Creates a Prediction or updates an existing Prediction in the hub.
593
+ #
594
+ # @param resource_group_name [String] The name of the resource group.
595
+ # @param hub_name [String] The name of the hub.
596
+ # @param prediction_name [String] The name of the Prediction.
597
+ # @param parameters [PredictionResourceFormat] Parameters supplied to the
598
+ # create/update Prediction operation.
599
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
600
+ # will be added to the HTTP request.
601
+ #
602
+ # @return [PredictionResourceFormat] operation results.
603
+ #
604
+ def begin_create_or_update(resource_group_name, hub_name, prediction_name, parameters, custom_headers = nil)
605
+ response = begin_create_or_update_async(resource_group_name, hub_name, prediction_name, parameters, custom_headers).value!
606
+ response.body unless response.nil?
607
+ end
608
+
609
+ #
610
+ # Creates a Prediction or updates an existing Prediction in the hub.
611
+ #
612
+ # @param resource_group_name [String] The name of the resource group.
613
+ # @param hub_name [String] The name of the hub.
614
+ # @param prediction_name [String] The name of the Prediction.
615
+ # @param parameters [PredictionResourceFormat] Parameters supplied to the
616
+ # create/update Prediction operation.
617
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
618
+ # will be added to the HTTP request.
619
+ #
620
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
621
+ #
622
+ def begin_create_or_update_with_http_info(resource_group_name, hub_name, prediction_name, parameters, custom_headers = nil)
623
+ begin_create_or_update_async(resource_group_name, hub_name, prediction_name, parameters, custom_headers).value!
624
+ end
625
+
626
+ #
627
+ # Creates a Prediction or updates an existing Prediction in the hub.
628
+ #
629
+ # @param resource_group_name [String] The name of the resource group.
630
+ # @param hub_name [String] The name of the hub.
631
+ # @param prediction_name [String] The name of the Prediction.
632
+ # @param parameters [PredictionResourceFormat] Parameters supplied to the
633
+ # create/update Prediction operation.
634
+ # @param [Hash{String => String}] A hash of custom headers that will be added
635
+ # to the HTTP request.
636
+ #
637
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
638
+ #
639
+ def begin_create_or_update_async(resource_group_name, hub_name, prediction_name, parameters, custom_headers = nil)
640
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
641
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
642
+ fail ArgumentError, 'prediction_name is nil' if prediction_name.nil?
643
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
644
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
645
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
646
+
647
+
648
+ request_headers = {}
649
+
650
+ # Set Headers
651
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
652
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
653
+
654
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
655
+
656
+ # Serialize Request
657
+ request_mapper = Azure::ARM::CustomerInsights::Models::PredictionResourceFormat.mapper()
658
+ request_content = @client.serialize(request_mapper, parameters)
659
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
660
+
661
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/predictions/{predictionName}'
662
+
663
+ request_url = @base_url || @client.base_url
664
+
665
+ options = {
666
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
667
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'predictionName' => prediction_name,'subscriptionId' => @client.subscription_id},
668
+ query_params: {'api-version' => @client.api_version},
669
+ body: request_content,
670
+ headers: request_headers.merge(custom_headers || {}),
671
+ base_url: request_url
672
+ }
673
+ promise = @client.make_request_async(:put, path_template, options)
674
+
675
+ promise = promise.then do |result|
676
+ http_response = result.response
677
+ status_code = http_response.status
678
+ response_content = http_response.body
679
+ unless status_code == 200 || status_code == 202
680
+ error_model = JSON.load(response_content)
681
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
682
+ end
683
+
684
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
685
+ # Deserialize Response
686
+ if status_code == 200
687
+ begin
688
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
689
+ result_mapper = Azure::ARM::CustomerInsights::Models::PredictionResourceFormat.mapper()
690
+ result.body = @client.deserialize(result_mapper, parsed_response)
691
+ rescue Exception => e
692
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
693
+ end
694
+ end
695
+
696
+ result
697
+ end
698
+
699
+ promise.execute
700
+ end
701
+
702
+ #
703
+ # Deletes a Prediction in the hub.
704
+ #
705
+ # @param resource_group_name [String] The name of the resource group.
706
+ # @param hub_name [String] The name of the hub.
707
+ # @param prediction_name [String] The name of the Prediction.
708
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
709
+ # will be added to the HTTP request.
710
+ #
711
+ #
712
+ def begin_delete(resource_group_name, hub_name, prediction_name, custom_headers = nil)
713
+ response = begin_delete_async(resource_group_name, hub_name, prediction_name, custom_headers).value!
714
+ nil
715
+ end
716
+
717
+ #
718
+ # Deletes a Prediction in the hub.
719
+ #
720
+ # @param resource_group_name [String] The name of the resource group.
721
+ # @param hub_name [String] The name of the hub.
722
+ # @param prediction_name [String] The name of the Prediction.
723
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
724
+ # will be added to the HTTP request.
725
+ #
726
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
727
+ #
728
+ def begin_delete_with_http_info(resource_group_name, hub_name, prediction_name, custom_headers = nil)
729
+ begin_delete_async(resource_group_name, hub_name, prediction_name, custom_headers).value!
730
+ end
731
+
732
+ #
733
+ # Deletes a Prediction in the hub.
734
+ #
735
+ # @param resource_group_name [String] The name of the resource group.
736
+ # @param hub_name [String] The name of the hub.
737
+ # @param prediction_name [String] The name of the Prediction.
738
+ # @param [Hash{String => String}] A hash of custom headers that will be added
739
+ # to the HTTP request.
740
+ #
741
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
742
+ #
743
+ def begin_delete_async(resource_group_name, hub_name, prediction_name, custom_headers = nil)
744
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
745
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
746
+ fail ArgumentError, 'prediction_name is nil' if prediction_name.nil?
747
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
748
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
749
+
750
+
751
+ request_headers = {}
752
+
753
+ # Set Headers
754
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
755
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
756
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/predictions/{predictionName}'
757
+
758
+ request_url = @base_url || @client.base_url
759
+
760
+ options = {
761
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
762
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'predictionName' => prediction_name,'subscriptionId' => @client.subscription_id},
763
+ query_params: {'api-version' => @client.api_version},
764
+ headers: request_headers.merge(custom_headers || {}),
765
+ base_url: request_url
766
+ }
767
+ promise = @client.make_request_async(:delete, path_template, options)
768
+
769
+ promise = promise.then do |result|
770
+ http_response = result.response
771
+ status_code = http_response.status
772
+ response_content = http_response.body
773
+ unless status_code == 200 || status_code == 202
774
+ error_model = JSON.load(response_content)
775
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
776
+ end
777
+
778
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
779
+
780
+ result
781
+ end
782
+
783
+ promise.execute
784
+ end
785
+
786
+ #
787
+ # Gets all the predictions in the specified hub.
788
+ #
789
+ # @param next_page_link [String] The NextLink from the previous successful call
790
+ # to List operation.
791
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
792
+ # will be added to the HTTP request.
793
+ #
794
+ # @return [PredictionListResult] operation results.
795
+ #
796
+ def list_by_hub_next(next_page_link, custom_headers = nil)
797
+ response = list_by_hub_next_async(next_page_link, custom_headers).value!
798
+ response.body unless response.nil?
799
+ end
800
+
801
+ #
802
+ # Gets all the predictions in the specified hub.
803
+ #
804
+ # @param next_page_link [String] The NextLink from the previous successful call
805
+ # to List operation.
806
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
807
+ # will be added to the HTTP request.
808
+ #
809
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
810
+ #
811
+ def list_by_hub_next_with_http_info(next_page_link, custom_headers = nil)
812
+ list_by_hub_next_async(next_page_link, custom_headers).value!
813
+ end
814
+
815
+ #
816
+ # Gets all the predictions in the specified hub.
817
+ #
818
+ # @param next_page_link [String] The NextLink from the previous successful call
819
+ # to List operation.
820
+ # @param [Hash{String => String}] A hash of custom headers that will be added
821
+ # to the HTTP request.
822
+ #
823
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
824
+ #
825
+ def list_by_hub_next_async(next_page_link, custom_headers = nil)
826
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
827
+
828
+
829
+ request_headers = {}
830
+
831
+ # Set Headers
832
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
833
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
834
+ path_template = '{nextLink}'
835
+
836
+ request_url = @base_url || @client.base_url
837
+
838
+ options = {
839
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
840
+ skip_encoding_path_params: {'nextLink' => next_page_link},
841
+ headers: request_headers.merge(custom_headers || {}),
842
+ base_url: request_url
843
+ }
844
+ promise = @client.make_request_async(:get, path_template, options)
845
+
846
+ promise = promise.then do |result|
847
+ http_response = result.response
848
+ status_code = http_response.status
849
+ response_content = http_response.body
850
+ unless status_code == 200
851
+ error_model = JSON.load(response_content)
852
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
853
+ end
854
+
855
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
856
+ # Deserialize Response
857
+ if status_code == 200
858
+ begin
859
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
860
+ result_mapper = Azure::ARM::CustomerInsights::Models::PredictionListResult.mapper()
861
+ result.body = @client.deserialize(result_mapper, parsed_response)
862
+ rescue Exception => e
863
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
864
+ end
865
+ end
866
+
867
+ result
868
+ end
869
+
870
+ promise.execute
871
+ end
872
+
873
+ #
874
+ # Gets all the predictions in the specified hub.
875
+ #
876
+ # @param resource_group_name [String] The name of the resource group.
877
+ # @param hub_name [String] The name of the hub.
878
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
879
+ # will be added to the HTTP request.
880
+ #
881
+ # @return [PredictionListResult] which provide lazy access to pages of the
882
+ # response.
883
+ #
884
+ def list_by_hub_as_lazy(resource_group_name, hub_name, custom_headers = nil)
885
+ response = list_by_hub_async(resource_group_name, hub_name, custom_headers).value!
886
+ unless response.nil?
887
+ page = response.body
888
+ page.next_method = Proc.new do |next_page_link|
889
+ list_by_hub_next_async(next_page_link, custom_headers)
890
+ end
891
+ page
892
+ end
893
+ end
894
+
895
+ end
896
+ end