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,689 @@
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 Kpi
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Kpi 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 KPI or updates an existing KPI 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 kpi_name [String] The name of the KPI.
33
+ # @param parameters [KpiResourceFormat] Parameters supplied to the
34
+ # create/update KPI 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 [KpiResourceFormat] operation results.
39
+ #
40
+ def create_or_update(resource_group_name, hub_name, kpi_name, parameters, custom_headers = nil)
41
+ response = create_or_update_async(resource_group_name, hub_name, kpi_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 kpi_name [String] The name of the KPI.
49
+ # @param parameters [KpiResourceFormat] Parameters supplied to the
50
+ # create/update KPI 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, kpi_name, parameters, custom_headers = nil)
58
+ # Send request
59
+ promise = begin_create_or_update_async(resource_group_name, hub_name, kpi_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::KpiResourceFormat.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 KPI 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 kpi_name [String] The name of the KPI.
81
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
82
+ # will be added to the HTTP request.
83
+ #
84
+ # @return [KpiResourceFormat] operation results.
85
+ #
86
+ def get(resource_group_name, hub_name, kpi_name, custom_headers = nil)
87
+ response = get_async(resource_group_name, hub_name, kpi_name, custom_headers).value!
88
+ response.body unless response.nil?
89
+ end
90
+
91
+ #
92
+ # Gets a KPI 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 kpi_name [String] The name of the KPI.
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, kpi_name, custom_headers = nil)
103
+ get_async(resource_group_name, hub_name, kpi_name, custom_headers).value!
104
+ end
105
+
106
+ #
107
+ # Gets a KPI 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 kpi_name [String] The name of the KPI.
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, kpi_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, 'kpi_name is nil' if kpi_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}/kpi/{kpiName}'
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,'kpiName' => kpi_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::KpiResourceFormat.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 KPI 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 kpi_name [String] The name of the KPI.
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, kpi_name, custom_headers = nil)
180
+ response = delete_async(resource_group_name, hub_name, kpi_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 kpi_name [String] The name of the KPI.
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, kpi_name, custom_headers = nil)
195
+ # Send request
196
+ promise = begin_delete_async(resource_group_name, hub_name, kpi_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
+ # Reprocesses the Kpi values of the specified KPI.
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 kpi_name [String] The name of the KPI.
216
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
217
+ # will be added to the HTTP request.
218
+ #
219
+ #
220
+ def reprocess(resource_group_name, hub_name, kpi_name, custom_headers = nil)
221
+ response = reprocess_async(resource_group_name, hub_name, kpi_name, custom_headers).value!
222
+ nil
223
+ end
224
+
225
+ #
226
+ # Reprocesses the Kpi values of the specified KPI.
227
+ #
228
+ # @param resource_group_name [String] The name of the resource group.
229
+ # @param hub_name [String] The name of the hub.
230
+ # @param kpi_name [String] The name of the KPI.
231
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
232
+ # will be added to the HTTP request.
233
+ #
234
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
235
+ #
236
+ def reprocess_with_http_info(resource_group_name, hub_name, kpi_name, custom_headers = nil)
237
+ reprocess_async(resource_group_name, hub_name, kpi_name, custom_headers).value!
238
+ end
239
+
240
+ #
241
+ # Reprocesses the Kpi values of the specified KPI.
242
+ #
243
+ # @param resource_group_name [String] The name of the resource group.
244
+ # @param hub_name [String] The name of the hub.
245
+ # @param kpi_name [String] The name of the KPI.
246
+ # @param [Hash{String => String}] A hash of custom headers that will be added
247
+ # to the HTTP request.
248
+ #
249
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
250
+ #
251
+ def reprocess_async(resource_group_name, hub_name, kpi_name, custom_headers = nil)
252
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
253
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
254
+ fail ArgumentError, 'kpi_name is nil' if kpi_name.nil?
255
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
256
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
257
+
258
+
259
+ request_headers = {}
260
+
261
+ # Set Headers
262
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
263
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
264
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}/reprocess'
265
+
266
+ request_url = @base_url || @client.base_url
267
+
268
+ options = {
269
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
270
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'kpiName' => kpi_name,'subscriptionId' => @client.subscription_id},
271
+ query_params: {'api-version' => @client.api_version},
272
+ headers: request_headers.merge(custom_headers || {}),
273
+ base_url: request_url
274
+ }
275
+ promise = @client.make_request_async(:post, path_template, options)
276
+
277
+ promise = promise.then do |result|
278
+ http_response = result.response
279
+ status_code = http_response.status
280
+ response_content = http_response.body
281
+ unless status_code == 202
282
+ error_model = JSON.load(response_content)
283
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
284
+ end
285
+
286
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
287
+
288
+ result
289
+ end
290
+
291
+ promise.execute
292
+ end
293
+
294
+ #
295
+ # Gets all the KPIs in the specified hub.
296
+ #
297
+ # @param resource_group_name [String] The name of the resource group.
298
+ # @param hub_name [String] The name of the hub.
299
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
300
+ # will be added to the HTTP request.
301
+ #
302
+ # @return [Array<KpiResourceFormat>] operation results.
303
+ #
304
+ def list_by_hub(resource_group_name, hub_name, custom_headers = nil)
305
+ first_page = list_by_hub_as_lazy(resource_group_name, hub_name, custom_headers)
306
+ first_page.get_all_items
307
+ end
308
+
309
+ #
310
+ # Gets all the KPIs in the specified hub.
311
+ #
312
+ # @param resource_group_name [String] The name of the resource group.
313
+ # @param hub_name [String] The name of the hub.
314
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
315
+ # will be added to the HTTP request.
316
+ #
317
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
318
+ #
319
+ def list_by_hub_with_http_info(resource_group_name, hub_name, custom_headers = nil)
320
+ list_by_hub_async(resource_group_name, hub_name, custom_headers).value!
321
+ end
322
+
323
+ #
324
+ # Gets all the KPIs in the specified hub.
325
+ #
326
+ # @param resource_group_name [String] The name of the resource group.
327
+ # @param hub_name [String] The name of the hub.
328
+ # @param [Hash{String => String}] A hash of custom headers that will be added
329
+ # to the HTTP request.
330
+ #
331
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
332
+ #
333
+ def list_by_hub_async(resource_group_name, hub_name, custom_headers = nil)
334
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
335
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
336
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
337
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
338
+
339
+
340
+ request_headers = {}
341
+
342
+ # Set Headers
343
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
344
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
345
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi'
346
+
347
+ request_url = @base_url || @client.base_url
348
+
349
+ options = {
350
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
351
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'subscriptionId' => @client.subscription_id},
352
+ query_params: {'api-version' => @client.api_version},
353
+ headers: request_headers.merge(custom_headers || {}),
354
+ base_url: request_url
355
+ }
356
+ promise = @client.make_request_async(:get, path_template, options)
357
+
358
+ promise = promise.then do |result|
359
+ http_response = result.response
360
+ status_code = http_response.status
361
+ response_content = http_response.body
362
+ unless status_code == 200
363
+ error_model = JSON.load(response_content)
364
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
365
+ end
366
+
367
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
368
+ # Deserialize Response
369
+ if status_code == 200
370
+ begin
371
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
372
+ result_mapper = Azure::ARM::CustomerInsights::Models::KpiListResult.mapper()
373
+ result.body = @client.deserialize(result_mapper, parsed_response)
374
+ rescue Exception => e
375
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
376
+ end
377
+ end
378
+
379
+ result
380
+ end
381
+
382
+ promise.execute
383
+ end
384
+
385
+ #
386
+ # Creates a KPI or updates an existing KPI in the hub.
387
+ #
388
+ # @param resource_group_name [String] The name of the resource group.
389
+ # @param hub_name [String] The name of the hub.
390
+ # @param kpi_name [String] The name of the KPI.
391
+ # @param parameters [KpiResourceFormat] Parameters supplied to the
392
+ # create/update KPI operation.
393
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
394
+ # will be added to the HTTP request.
395
+ #
396
+ # @return [KpiResourceFormat] operation results.
397
+ #
398
+ def begin_create_or_update(resource_group_name, hub_name, kpi_name, parameters, custom_headers = nil)
399
+ response = begin_create_or_update_async(resource_group_name, hub_name, kpi_name, parameters, custom_headers).value!
400
+ response.body unless response.nil?
401
+ end
402
+
403
+ #
404
+ # Creates a KPI or updates an existing KPI in the hub.
405
+ #
406
+ # @param resource_group_name [String] The name of the resource group.
407
+ # @param hub_name [String] The name of the hub.
408
+ # @param kpi_name [String] The name of the KPI.
409
+ # @param parameters [KpiResourceFormat] Parameters supplied to the
410
+ # create/update KPI operation.
411
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
412
+ # will be added to the HTTP request.
413
+ #
414
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
415
+ #
416
+ def begin_create_or_update_with_http_info(resource_group_name, hub_name, kpi_name, parameters, custom_headers = nil)
417
+ begin_create_or_update_async(resource_group_name, hub_name, kpi_name, parameters, custom_headers).value!
418
+ end
419
+
420
+ #
421
+ # Creates a KPI or updates an existing KPI in the hub.
422
+ #
423
+ # @param resource_group_name [String] The name of the resource group.
424
+ # @param hub_name [String] The name of the hub.
425
+ # @param kpi_name [String] The name of the KPI.
426
+ # @param parameters [KpiResourceFormat] Parameters supplied to the
427
+ # create/update KPI operation.
428
+ # @param [Hash{String => String}] A hash of custom headers that will be added
429
+ # to the HTTP request.
430
+ #
431
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
432
+ #
433
+ def begin_create_or_update_async(resource_group_name, hub_name, kpi_name, parameters, custom_headers = nil)
434
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
435
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
436
+ fail ArgumentError, 'kpi_name is nil' if kpi_name.nil?
437
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
438
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
439
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
440
+
441
+
442
+ request_headers = {}
443
+
444
+ # Set Headers
445
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
446
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
447
+
448
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
449
+
450
+ # Serialize Request
451
+ request_mapper = Azure::ARM::CustomerInsights::Models::KpiResourceFormat.mapper()
452
+ request_content = @client.serialize(request_mapper, parameters)
453
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
454
+
455
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}'
456
+
457
+ request_url = @base_url || @client.base_url
458
+
459
+ options = {
460
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
461
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'kpiName' => kpi_name,'subscriptionId' => @client.subscription_id},
462
+ query_params: {'api-version' => @client.api_version},
463
+ body: request_content,
464
+ headers: request_headers.merge(custom_headers || {}),
465
+ base_url: request_url
466
+ }
467
+ promise = @client.make_request_async(:put, path_template, options)
468
+
469
+ promise = promise.then do |result|
470
+ http_response = result.response
471
+ status_code = http_response.status
472
+ response_content = http_response.body
473
+ unless status_code == 200 || status_code == 202
474
+ error_model = JSON.load(response_content)
475
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
476
+ end
477
+
478
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
479
+ # Deserialize Response
480
+ if status_code == 200
481
+ begin
482
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
483
+ result_mapper = Azure::ARM::CustomerInsights::Models::KpiResourceFormat.mapper()
484
+ result.body = @client.deserialize(result_mapper, parsed_response)
485
+ rescue Exception => e
486
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
487
+ end
488
+ end
489
+
490
+ result
491
+ end
492
+
493
+ promise.execute
494
+ end
495
+
496
+ #
497
+ # Deletes a KPI in the hub.
498
+ #
499
+ # @param resource_group_name [String] The name of the resource group.
500
+ # @param hub_name [String] The name of the hub.
501
+ # @param kpi_name [String] The name of the KPI.
502
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
503
+ # will be added to the HTTP request.
504
+ #
505
+ #
506
+ def begin_delete(resource_group_name, hub_name, kpi_name, custom_headers = nil)
507
+ response = begin_delete_async(resource_group_name, hub_name, kpi_name, custom_headers).value!
508
+ nil
509
+ end
510
+
511
+ #
512
+ # Deletes a KPI in the hub.
513
+ #
514
+ # @param resource_group_name [String] The name of the resource group.
515
+ # @param hub_name [String] The name of the hub.
516
+ # @param kpi_name [String] The name of the KPI.
517
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
518
+ # will be added to the HTTP request.
519
+ #
520
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
521
+ #
522
+ def begin_delete_with_http_info(resource_group_name, hub_name, kpi_name, custom_headers = nil)
523
+ begin_delete_async(resource_group_name, hub_name, kpi_name, custom_headers).value!
524
+ end
525
+
526
+ #
527
+ # Deletes a KPI in the hub.
528
+ #
529
+ # @param resource_group_name [String] The name of the resource group.
530
+ # @param hub_name [String] The name of the hub.
531
+ # @param kpi_name [String] The name of the KPI.
532
+ # @param [Hash{String => String}] A hash of custom headers that will be added
533
+ # to the HTTP request.
534
+ #
535
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
536
+ #
537
+ def begin_delete_async(resource_group_name, hub_name, kpi_name, custom_headers = nil)
538
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
539
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
540
+ fail ArgumentError, 'kpi_name is nil' if kpi_name.nil?
541
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
542
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
543
+
544
+
545
+ request_headers = {}
546
+
547
+ # Set Headers
548
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
549
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
550
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}'
551
+
552
+ request_url = @base_url || @client.base_url
553
+
554
+ options = {
555
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
556
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'kpiName' => kpi_name,'subscriptionId' => @client.subscription_id},
557
+ query_params: {'api-version' => @client.api_version},
558
+ headers: request_headers.merge(custom_headers || {}),
559
+ base_url: request_url
560
+ }
561
+ promise = @client.make_request_async(:delete, path_template, options)
562
+
563
+ promise = promise.then do |result|
564
+ http_response = result.response
565
+ status_code = http_response.status
566
+ response_content = http_response.body
567
+ unless status_code == 200 || status_code == 202
568
+ error_model = JSON.load(response_content)
569
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
570
+ end
571
+
572
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
573
+
574
+ result
575
+ end
576
+
577
+ promise.execute
578
+ end
579
+
580
+ #
581
+ # Gets all the KPIs in the specified hub.
582
+ #
583
+ # @param next_page_link [String] The NextLink from the previous successful call
584
+ # to List operation.
585
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
586
+ # will be added to the HTTP request.
587
+ #
588
+ # @return [KpiListResult] operation results.
589
+ #
590
+ def list_by_hub_next(next_page_link, custom_headers = nil)
591
+ response = list_by_hub_next_async(next_page_link, custom_headers).value!
592
+ response.body unless response.nil?
593
+ end
594
+
595
+ #
596
+ # Gets all the KPIs in the specified hub.
597
+ #
598
+ # @param next_page_link [String] The NextLink from the previous successful call
599
+ # to List operation.
600
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
601
+ # will be added to the HTTP request.
602
+ #
603
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
604
+ #
605
+ def list_by_hub_next_with_http_info(next_page_link, custom_headers = nil)
606
+ list_by_hub_next_async(next_page_link, custom_headers).value!
607
+ end
608
+
609
+ #
610
+ # Gets all the KPIs in the specified hub.
611
+ #
612
+ # @param next_page_link [String] The NextLink from the previous successful call
613
+ # to List operation.
614
+ # @param [Hash{String => String}] A hash of custom headers that will be added
615
+ # to the HTTP request.
616
+ #
617
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
618
+ #
619
+ def list_by_hub_next_async(next_page_link, custom_headers = nil)
620
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
621
+
622
+
623
+ request_headers = {}
624
+
625
+ # Set Headers
626
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
627
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
628
+ path_template = '{nextLink}'
629
+
630
+ request_url = @base_url || @client.base_url
631
+
632
+ options = {
633
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
634
+ skip_encoding_path_params: {'nextLink' => next_page_link},
635
+ headers: request_headers.merge(custom_headers || {}),
636
+ base_url: request_url
637
+ }
638
+ promise = @client.make_request_async(:get, path_template, options)
639
+
640
+ promise = promise.then do |result|
641
+ http_response = result.response
642
+ status_code = http_response.status
643
+ response_content = http_response.body
644
+ unless status_code == 200
645
+ error_model = JSON.load(response_content)
646
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
647
+ end
648
+
649
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
650
+ # Deserialize Response
651
+ if status_code == 200
652
+ begin
653
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
654
+ result_mapper = Azure::ARM::CustomerInsights::Models::KpiListResult.mapper()
655
+ result.body = @client.deserialize(result_mapper, parsed_response)
656
+ rescue Exception => e
657
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
658
+ end
659
+ end
660
+
661
+ result
662
+ end
663
+
664
+ promise.execute
665
+ end
666
+
667
+ #
668
+ # Gets all the KPIs in the specified hub.
669
+ #
670
+ # @param resource_group_name [String] The name of the resource group.
671
+ # @param hub_name [String] The name of the hub.
672
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
673
+ # will be added to the HTTP request.
674
+ #
675
+ # @return [KpiListResult] which provide lazy access to pages of the response.
676
+ #
677
+ def list_by_hub_as_lazy(resource_group_name, hub_name, custom_headers = nil)
678
+ response = list_by_hub_async(resource_group_name, hub_name, custom_headers).value!
679
+ unless response.nil?
680
+ page = response.body
681
+ page.next_method = Proc.new do |next_page_link|
682
+ list_by_hub_next_async(next_page_link, custom_headers)
683
+ end
684
+ page
685
+ end
686
+ end
687
+
688
+ end
689
+ end