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,610 @@
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 RelationshipLinks
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the RelationshipLinks 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 relationship link or updates an existing relationship link within a
29
+ # hub.
30
+ #
31
+ # @param resource_group_name [String] The name of the resource group.
32
+ # @param hub_name [String] The name of the hub.
33
+ # @param relationship_link_name [String] The name of the relationship link.
34
+ # @param parameters [RelationshipLinkResourceFormat] Parameters supplied to the
35
+ # CreateOrUpdate relationship link operation.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [RelationshipLinkResourceFormat] operation results.
40
+ #
41
+ def create_or_update(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers = nil)
42
+ response = create_or_update_async(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group.
48
+ # @param hub_name [String] The name of the hub.
49
+ # @param relationship_link_name [String] The name of the relationship link.
50
+ # @param parameters [RelationshipLinkResourceFormat] Parameters supplied to the
51
+ # CreateOrUpdate relationship link operation.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] promise which provides async access to http
56
+ # response.
57
+ #
58
+ def create_or_update_async(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers = nil)
59
+ # Send request
60
+ promise = begin_create_or_update_async(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers)
61
+
62
+ promise = promise.then do |response|
63
+ # Defining deserialization method.
64
+ deserialize_method = lambda do |parsed_response|
65
+ result_mapper = Azure::ARM::CustomerInsights::Models::RelationshipLinkResourceFormat.mapper()
66
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
67
+ end
68
+
69
+ # Waiting for response.
70
+ @client.get_long_running_operation_result(response, deserialize_method)
71
+ end
72
+
73
+ promise
74
+ end
75
+
76
+ #
77
+ # Gets information about the specified relationship Link.
78
+ #
79
+ # @param resource_group_name [String] The name of the resource group.
80
+ # @param hub_name [String] The name of the hub.
81
+ # @param relationship_link_name [String] The name of the relationship link.
82
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
83
+ # will be added to the HTTP request.
84
+ #
85
+ # @return [RelationshipLinkResourceFormat] operation results.
86
+ #
87
+ def get(resource_group_name, hub_name, relationship_link_name, custom_headers = nil)
88
+ response = get_async(resource_group_name, hub_name, relationship_link_name, custom_headers).value!
89
+ response.body unless response.nil?
90
+ end
91
+
92
+ #
93
+ # Gets information about the specified relationship Link.
94
+ #
95
+ # @param resource_group_name [String] The name of the resource group.
96
+ # @param hub_name [String] The name of the hub.
97
+ # @param relationship_link_name [String] The name of the relationship link.
98
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
99
+ # will be added to the HTTP request.
100
+ #
101
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
102
+ #
103
+ def get_with_http_info(resource_group_name, hub_name, relationship_link_name, custom_headers = nil)
104
+ get_async(resource_group_name, hub_name, relationship_link_name, custom_headers).value!
105
+ end
106
+
107
+ #
108
+ # Gets information about the specified relationship Link.
109
+ #
110
+ # @param resource_group_name [String] The name of the resource group.
111
+ # @param hub_name [String] The name of the hub.
112
+ # @param relationship_link_name [String] The name of the relationship link.
113
+ # @param [Hash{String => String}] A hash of custom headers that will be added
114
+ # to the HTTP request.
115
+ #
116
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
117
+ #
118
+ def get_async(resource_group_name, hub_name, relationship_link_name, custom_headers = nil)
119
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
120
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
121
+ fail ArgumentError, 'relationship_link_name is nil' if relationship_link_name.nil?
122
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
123
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
124
+
125
+
126
+ request_headers = {}
127
+
128
+ # Set Headers
129
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
130
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
131
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}'
132
+
133
+ request_url = @base_url || @client.base_url
134
+
135
+ options = {
136
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
137
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'relationshipLinkName' => relationship_link_name,'subscriptionId' => @client.subscription_id},
138
+ query_params: {'api-version' => @client.api_version},
139
+ headers: request_headers.merge(custom_headers || {}),
140
+ base_url: request_url
141
+ }
142
+ promise = @client.make_request_async(:get, path_template, options)
143
+
144
+ promise = promise.then do |result|
145
+ http_response = result.response
146
+ status_code = http_response.status
147
+ response_content = http_response.body
148
+ unless status_code == 200
149
+ error_model = JSON.load(response_content)
150
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
151
+ end
152
+
153
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
154
+ # Deserialize Response
155
+ if status_code == 200
156
+ begin
157
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
158
+ result_mapper = Azure::ARM::CustomerInsights::Models::RelationshipLinkResourceFormat.mapper()
159
+ result.body = @client.deserialize(result_mapper, parsed_response)
160
+ rescue Exception => e
161
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
162
+ end
163
+ end
164
+
165
+ result
166
+ end
167
+
168
+ promise.execute
169
+ end
170
+
171
+ #
172
+ # Deletes a relationship link within a hub.
173
+ #
174
+ # @param resource_group_name [String] The name of the resource group.
175
+ # @param hub_name [String] The name of the hub.
176
+ # @param relationship_link_name [String] The name of the relationship.
177
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
178
+ # will be added to the HTTP request.
179
+ #
180
+ def delete(resource_group_name, hub_name, relationship_link_name, custom_headers = nil)
181
+ response = delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers).value!
182
+ nil
183
+ end
184
+
185
+ #
186
+ # @param resource_group_name [String] The name of the resource group.
187
+ # @param hub_name [String] The name of the hub.
188
+ # @param relationship_link_name [String] The name of the relationship.
189
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
190
+ # will be added to the HTTP request.
191
+ #
192
+ # @return [Concurrent::Promise] promise which provides async access to http
193
+ # response.
194
+ #
195
+ def delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers = nil)
196
+ # Send request
197
+ promise = begin_delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers)
198
+
199
+ promise = promise.then do |response|
200
+ # Defining deserialization method.
201
+ deserialize_method = lambda do |parsed_response|
202
+ end
203
+
204
+ # Waiting for response.
205
+ @client.get_long_running_operation_result(response, deserialize_method)
206
+ end
207
+
208
+ promise
209
+ end
210
+
211
+ #
212
+ # Gets all relationship links in the hub.
213
+ #
214
+ # @param resource_group_name [String] The name of the resource group.
215
+ # @param hub_name [String] The name of the hub.
216
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
217
+ # will be added to the HTTP request.
218
+ #
219
+ # @return [Array<RelationshipLinkResourceFormat>] operation results.
220
+ #
221
+ def list_by_hub(resource_group_name, hub_name, custom_headers = nil)
222
+ first_page = list_by_hub_as_lazy(resource_group_name, hub_name, custom_headers)
223
+ first_page.get_all_items
224
+ end
225
+
226
+ #
227
+ # Gets all relationship links in the hub.
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 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 list_by_hub_with_http_info(resource_group_name, hub_name, custom_headers = nil)
237
+ list_by_hub_async(resource_group_name, hub_name, custom_headers).value!
238
+ end
239
+
240
+ #
241
+ # Gets all relationship links in the hub.
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 [Hash{String => String}] A hash of custom headers that will be added
246
+ # to the HTTP request.
247
+ #
248
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
249
+ #
250
+ def list_by_hub_async(resource_group_name, hub_name, custom_headers = nil)
251
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
252
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
253
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
254
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
255
+
256
+
257
+ request_headers = {}
258
+
259
+ # Set Headers
260
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
261
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
262
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks'
263
+
264
+ request_url = @base_url || @client.base_url
265
+
266
+ options = {
267
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
268
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'subscriptionId' => @client.subscription_id},
269
+ query_params: {'api-version' => @client.api_version},
270
+ headers: request_headers.merge(custom_headers || {}),
271
+ base_url: request_url
272
+ }
273
+ promise = @client.make_request_async(:get, path_template, options)
274
+
275
+ promise = promise.then do |result|
276
+ http_response = result.response
277
+ status_code = http_response.status
278
+ response_content = http_response.body
279
+ unless status_code == 200
280
+ error_model = JSON.load(response_content)
281
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
282
+ end
283
+
284
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
285
+ # Deserialize Response
286
+ if status_code == 200
287
+ begin
288
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
289
+ result_mapper = Azure::ARM::CustomerInsights::Models::RelationshipLinkListResult.mapper()
290
+ result.body = @client.deserialize(result_mapper, parsed_response)
291
+ rescue Exception => e
292
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
293
+ end
294
+ end
295
+
296
+ result
297
+ end
298
+
299
+ promise.execute
300
+ end
301
+
302
+ #
303
+ # Creates a relationship link or updates an existing relationship link within a
304
+ # hub.
305
+ #
306
+ # @param resource_group_name [String] The name of the resource group.
307
+ # @param hub_name [String] The name of the hub.
308
+ # @param relationship_link_name [String] The name of the relationship link.
309
+ # @param parameters [RelationshipLinkResourceFormat] Parameters supplied to the
310
+ # CreateOrUpdate relationship link operation.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [RelationshipLinkResourceFormat] operation results.
315
+ #
316
+ def begin_create_or_update(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers = nil)
317
+ response = begin_create_or_update_async(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers).value!
318
+ response.body unless response.nil?
319
+ end
320
+
321
+ #
322
+ # Creates a relationship link or updates an existing relationship link within a
323
+ # hub.
324
+ #
325
+ # @param resource_group_name [String] The name of the resource group.
326
+ # @param hub_name [String] The name of the hub.
327
+ # @param relationship_link_name [String] The name of the relationship link.
328
+ # @param parameters [RelationshipLinkResourceFormat] Parameters supplied to the
329
+ # CreateOrUpdate relationship link operation.
330
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
331
+ # will be added to the HTTP request.
332
+ #
333
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
334
+ #
335
+ def begin_create_or_update_with_http_info(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers = nil)
336
+ begin_create_or_update_async(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers).value!
337
+ end
338
+
339
+ #
340
+ # Creates a relationship link or updates an existing relationship link within a
341
+ # hub.
342
+ #
343
+ # @param resource_group_name [String] The name of the resource group.
344
+ # @param hub_name [String] The name of the hub.
345
+ # @param relationship_link_name [String] The name of the relationship link.
346
+ # @param parameters [RelationshipLinkResourceFormat] Parameters supplied to the
347
+ # CreateOrUpdate relationship link operation.
348
+ # @param [Hash{String => String}] A hash of custom headers that will be added
349
+ # to the HTTP request.
350
+ #
351
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
352
+ #
353
+ def begin_create_or_update_async(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers = nil)
354
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
355
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
356
+ fail ArgumentError, 'relationship_link_name is nil' if relationship_link_name.nil?
357
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
358
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
359
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
360
+
361
+
362
+ request_headers = {}
363
+
364
+ # Set Headers
365
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
366
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
367
+
368
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
369
+
370
+ # Serialize Request
371
+ request_mapper = Azure::ARM::CustomerInsights::Models::RelationshipLinkResourceFormat.mapper()
372
+ request_content = @client.serialize(request_mapper, parameters)
373
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
374
+
375
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}'
376
+
377
+ request_url = @base_url || @client.base_url
378
+
379
+ options = {
380
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
381
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'relationshipLinkName' => relationship_link_name,'subscriptionId' => @client.subscription_id},
382
+ query_params: {'api-version' => @client.api_version},
383
+ body: request_content,
384
+ headers: request_headers.merge(custom_headers || {}),
385
+ base_url: request_url
386
+ }
387
+ promise = @client.make_request_async(:put, path_template, options)
388
+
389
+ promise = promise.then do |result|
390
+ http_response = result.response
391
+ status_code = http_response.status
392
+ response_content = http_response.body
393
+ unless status_code == 200 || status_code == 202
394
+ error_model = JSON.load(response_content)
395
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
396
+ end
397
+
398
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
399
+ # Deserialize Response
400
+ if status_code == 200
401
+ begin
402
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
403
+ result_mapper = Azure::ARM::CustomerInsights::Models::RelationshipLinkResourceFormat.mapper()
404
+ result.body = @client.deserialize(result_mapper, parsed_response)
405
+ rescue Exception => e
406
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
407
+ end
408
+ end
409
+
410
+ result
411
+ end
412
+
413
+ promise.execute
414
+ end
415
+
416
+ #
417
+ # Deletes a relationship link within a hub.
418
+ #
419
+ # @param resource_group_name [String] The name of the resource group.
420
+ # @param hub_name [String] The name of the hub.
421
+ # @param relationship_link_name [String] The name of the relationship.
422
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
423
+ # will be added to the HTTP request.
424
+ #
425
+ #
426
+ def begin_delete(resource_group_name, hub_name, relationship_link_name, custom_headers = nil)
427
+ response = begin_delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers).value!
428
+ nil
429
+ end
430
+
431
+ #
432
+ # Deletes a relationship link within a hub.
433
+ #
434
+ # @param resource_group_name [String] The name of the resource group.
435
+ # @param hub_name [String] The name of the hub.
436
+ # @param relationship_link_name [String] The name of the relationship.
437
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
438
+ # will be added to the HTTP request.
439
+ #
440
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
441
+ #
442
+ def begin_delete_with_http_info(resource_group_name, hub_name, relationship_link_name, custom_headers = nil)
443
+ begin_delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers).value!
444
+ end
445
+
446
+ #
447
+ # Deletes a relationship link within a hub.
448
+ #
449
+ # @param resource_group_name [String] The name of the resource group.
450
+ # @param hub_name [String] The name of the hub.
451
+ # @param relationship_link_name [String] The name of the relationship.
452
+ # @param [Hash{String => String}] A hash of custom headers that will be added
453
+ # to the HTTP request.
454
+ #
455
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
456
+ #
457
+ def begin_delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers = nil)
458
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
459
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
460
+ fail ArgumentError, 'relationship_link_name is nil' if relationship_link_name.nil?
461
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
462
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
463
+
464
+
465
+ request_headers = {}
466
+
467
+ # Set Headers
468
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
469
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
470
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}'
471
+
472
+ request_url = @base_url || @client.base_url
473
+
474
+ options = {
475
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
476
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'relationshipLinkName' => relationship_link_name,'subscriptionId' => @client.subscription_id},
477
+ query_params: {'api-version' => @client.api_version},
478
+ headers: request_headers.merge(custom_headers || {}),
479
+ base_url: request_url
480
+ }
481
+ promise = @client.make_request_async(:delete, 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 == 202 || 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 relationship links in the hub.
502
+ #
503
+ # @param next_page_link [String] The NextLink from the previous successful call
504
+ # to List operation.
505
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
506
+ # will be added to the HTTP request.
507
+ #
508
+ # @return [RelationshipLinkListResult] operation results.
509
+ #
510
+ def list_by_hub_next(next_page_link, custom_headers = nil)
511
+ response = list_by_hub_next_async(next_page_link, custom_headers).value!
512
+ response.body unless response.nil?
513
+ end
514
+
515
+ #
516
+ # Gets all relationship links in the hub.
517
+ #
518
+ # @param next_page_link [String] The NextLink from the previous successful call
519
+ # to List operation.
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_next_with_http_info(next_page_link, custom_headers = nil)
526
+ list_by_hub_next_async(next_page_link, custom_headers).value!
527
+ end
528
+
529
+ #
530
+ # Gets all relationship links in the hub.
531
+ #
532
+ # @param next_page_link [String] The NextLink from the previous successful call
533
+ # to List operation.
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_next_async(next_page_link, custom_headers = nil)
540
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
541
+
542
+
543
+ request_headers = {}
544
+
545
+ # Set Headers
546
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
547
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
548
+ path_template = '{nextLink}'
549
+
550
+ request_url = @base_url || @client.base_url
551
+
552
+ options = {
553
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
554
+ skip_encoding_path_params: {'nextLink' => next_page_link},
555
+ headers: request_headers.merge(custom_headers || {}),
556
+ base_url: request_url
557
+ }
558
+ promise = @client.make_request_async(:get, path_template, options)
559
+
560
+ promise = promise.then do |result|
561
+ http_response = result.response
562
+ status_code = http_response.status
563
+ response_content = http_response.body
564
+ unless status_code == 200
565
+ error_model = JSON.load(response_content)
566
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
567
+ end
568
+
569
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
570
+ # Deserialize Response
571
+ if status_code == 200
572
+ begin
573
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
574
+ result_mapper = Azure::ARM::CustomerInsights::Models::RelationshipLinkListResult.mapper()
575
+ result.body = @client.deserialize(result_mapper, parsed_response)
576
+ rescue Exception => e
577
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
578
+ end
579
+ end
580
+
581
+ result
582
+ end
583
+
584
+ promise.execute
585
+ end
586
+
587
+ #
588
+ # Gets all relationship links in the hub.
589
+ #
590
+ # @param resource_group_name [String] The name of the resource group.
591
+ # @param hub_name [String] The name of the hub.
592
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
593
+ # will be added to the HTTP request.
594
+ #
595
+ # @return [RelationshipLinkListResult] which provide lazy access to pages of
596
+ # the response.
597
+ #
598
+ def list_by_hub_as_lazy(resource_group_name, hub_name, custom_headers = nil)
599
+ response = list_by_hub_async(resource_group_name, hub_name, custom_headers).value!
600
+ unless response.nil?
601
+ page = response.body
602
+ page.next_method = Proc.new do |next_page_link|
603
+ list_by_hub_next_async(next_page_link, custom_headers)
604
+ end
605
+ page
606
+ end
607
+ end
608
+
609
+ end
610
+ end