azure_mgmt_customer_insights 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-01-01/generated/azure_mgmt_customer_insights.rb +132 -0
  3. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/authorization_policies.rb +641 -0
  4. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/connector_mappings.rb +554 -0
  5. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/connectors.rb +612 -0
  6. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/customer_insights_management_client.rb +192 -0
  7. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/hubs.rb +848 -0
  8. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/images.rb +240 -0
  9. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/interactions.rb +597 -0
  10. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/kpi.rb +696 -0
  11. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/links.rb +571 -0
  12. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/assignment_principal.rb +76 -0
  13. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/authorization_policy.rb +93 -0
  14. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/authorization_policy_list_result.rb +99 -0
  15. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/authorization_policy_resource_format.rb +120 -0
  16. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/azure_blob_connector_properties.rb +46 -0
  17. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/calculation_window_types.rb +19 -0
  18. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/cardinality_types.rb +17 -0
  19. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/completion_operation_types.rb +17 -0
  20. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_list_result.rb +98 -0
  21. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_mapping_availability.rb +59 -0
  22. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_mapping_complete_operation.rb +60 -0
  23. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_mapping_error_management.rb +60 -0
  24. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_mapping_format.rb +104 -0
  25. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_mapping_list_result.rb +99 -0
  26. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_mapping_properties.rb +141 -0
  27. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_mapping_resource_format.rb +245 -0
  28. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_mapping_states.rb +21 -0
  29. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_mapping_structure.rb +79 -0
  30. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_resource_format.rb +199 -0
  31. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_states.rb +20 -0
  32. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/connector_types.rb +20 -0
  33. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/crm_connector_entities.rb +68 -0
  34. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/crm_connector_properties.rb +100 -0
  35. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/data_source_precedence.rb +109 -0
  36. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/data_source_type.rb +17 -0
  37. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/enriching_kpi.rb +256 -0
  38. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/entity_type_definition.rb +268 -0
  39. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/entity_types.rb +18 -0
  40. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/error_management_types.rb +17 -0
  41. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/frequency_types.rb +19 -0
  42. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/get_image_upload_url_input.rb +68 -0
  43. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/hub.rb +147 -0
  44. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/hub_billing_info_format.rb +78 -0
  45. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/hub_list_result.rb +98 -0
  46. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/image_definition.rb +68 -0
  47. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/instance_operation_type.rb +16 -0
  48. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/interaction_list_result.rb +99 -0
  49. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/interaction_resource_format.rb +475 -0
  50. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/kpi_alias.rb +57 -0
  51. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/kpi_definition.rb +320 -0
  52. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/kpi_extract.rb +57 -0
  53. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/kpi_functions.rb +22 -0
  54. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/kpi_group_by_metadata.rb +76 -0
  55. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/kpi_list_result.rb +98 -0
  56. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/kpi_participant_profiles_metadata.rb +46 -0
  57. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/kpi_resource_format.rb +347 -0
  58. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/kpi_thresholds.rb +68 -0
  59. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/link_list_result.rb +98 -0
  60. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/link_resource_format.rb +230 -0
  61. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/link_types.rb +16 -0
  62. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/metadata_definition_base.rb +166 -0
  63. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/operation.rb +59 -0
  64. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/operation_display.rb +72 -0
  65. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/operation_list_result.rb +103 -0
  66. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/participant.rb +127 -0
  67. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/participant_property_reference.rb +59 -0
  68. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/permission_types.rb +17 -0
  69. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/profile_enum_valid_values_format.rb +65 -0
  70. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/profile_list_result.rb +98 -0
  71. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/profile_resource_format.rb +342 -0
  72. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/property_definition.rb +237 -0
  73. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/provisioning_states.rb +20 -0
  74. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/proxy_resource.rb +71 -0
  75. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/relationship_link_field_mapping.rb +70 -0
  76. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/relationship_link_list_result.rb +99 -0
  77. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/relationship_link_resource_format.rb +238 -0
  78. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/relationship_list_result.rb +99 -0
  79. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/relationship_resource_format.rb +239 -0
  80. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/relationship_type_field_mapping.rb +58 -0
  81. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/relationship_type_mapping.rb +58 -0
  82. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/relationships_lookup.rb +115 -0
  83. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/resource.rb +101 -0
  84. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/resource_set_description.rb +74 -0
  85. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/role_assignment_list_result.rb +99 -0
  86. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/role_assignment_resource_format.rb +333 -0
  87. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/role_list_result.rb +98 -0
  88. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/role_resource_format.rb +84 -0
  89. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/role_types.rb +20 -0
  90. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/salesforce_connector_properties.rb +67 -0
  91. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/salesforce_discover_setting.rb +46 -0
  92. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/salesforce_table.rb +90 -0
  93. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/status.rb +17 -0
  94. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/strong_id.rb +103 -0
  95. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/suggest_relationship_links_response.rb +69 -0
  96. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/type_properties_mapping.rb +82 -0
  97. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/view_list_result.rb +98 -0
  98. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/view_resource_format.rb +151 -0
  99. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/widget_type_list_result.rb +99 -0
  100. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/models/widget_type_resource_format.rb +174 -0
  101. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/module_definition.rb +9 -0
  102. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/operations.rb +218 -0
  103. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/profiles.rb +742 -0
  104. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/relationship_links.rb +616 -0
  105. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/relationships.rb +612 -0
  106. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/role_assignments.rb +572 -0
  107. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/roles.rb +229 -0
  108. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/views.rb +535 -0
  109. data/lib/2017-01-01/generated/azure_mgmt_customer_insights/widget_types.rb +326 -0
  110. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/authorization_policies.rb +39 -35
  111. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/connector_mappings.rb +33 -30
  112. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/connectors.rb +41 -38
  113. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/customer_insights_management_client.rb +4 -1
  114. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/hubs.rb +58 -54
  115. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/images.rb +12 -14
  116. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/interactions.rb +37 -34
  117. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/kpi.rb +47 -43
  118. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/links.rb +37 -34
  119. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/operations.rb +15 -13
  120. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/predictions.rb +59 -55
  121. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/profiles.rb +47 -43
  122. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/relationship_links.rb +41 -38
  123. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/relationships.rb +41 -38
  124. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/role_assignments.rb +37 -34
  125. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/roles.rb +15 -13
  126. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/views.rb +33 -30
  127. data/lib/2017-04-26/generated/azure_mgmt_customer_insights/widget_types.rb +21 -18
  128. data/lib/azure_mgmt_customer_insights.rb +1 -0
  129. data/lib/profiles/latest/customerinsights_latest_profile_client.rb +28 -9
  130. data/lib/profiles/latest/customerinsights_module_definition.rb +0 -1
  131. data/lib/profiles/latest/modules/customerinsights_profile_module.rb +356 -337
  132. data/lib/version.rb +1 -1
  133. metadata +110 -2
@@ -0,0 +1,616 @@
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::CustomerInsights::Mgmt::V2017_01_01
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: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:custom_headers)
61
+
62
+ promise = promise.then do |response|
63
+ # Defining deserialization method.
64
+ deserialize_method = lambda do |parsed_response|
65
+ result_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::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: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: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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
128
+
129
+ # Set Headers
130
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
131
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
132
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}'
133
+
134
+ request_url = @base_url || @client.base_url
135
+
136
+ options = {
137
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
138
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'relationshipLinkName' => relationship_link_name,'subscriptionId' => @client.subscription_id},
139
+ query_params: {'api-version' => @client.api_version},
140
+ headers: request_headers.merge(custom_headers || {}),
141
+ base_url: request_url
142
+ }
143
+ promise = @client.make_request_async(:get, path_template, options)
144
+
145
+ promise = promise.then do |result|
146
+ http_response = result.response
147
+ status_code = http_response.status
148
+ response_content = http_response.body
149
+ unless status_code == 200
150
+ error_model = JSON.load(response_content)
151
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
152
+ end
153
+
154
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
155
+ # Deserialize Response
156
+ if status_code == 200
157
+ begin
158
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
159
+ result_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipLinkResourceFormat.mapper()
160
+ result.body = @client.deserialize(result_mapper, parsed_response)
161
+ rescue Exception => e
162
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
163
+ end
164
+ end
165
+
166
+ result
167
+ end
168
+
169
+ promise.execute
170
+ end
171
+
172
+ #
173
+ # Deletes a relationship link within a hub.
174
+ #
175
+ # @param resource_group_name [String] The name of the resource group.
176
+ # @param hub_name [String] The name of the hub.
177
+ # @param relationship_link_name [String] The name of the relationship.
178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
179
+ # will be added to the HTTP request.
180
+ #
181
+ def delete(resource_group_name, hub_name, relationship_link_name, custom_headers:nil)
182
+ response = delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers:custom_headers).value!
183
+ nil
184
+ end
185
+
186
+ #
187
+ # @param resource_group_name [String] The name of the resource group.
188
+ # @param hub_name [String] The name of the hub.
189
+ # @param relationship_link_name [String] The name of the relationship.
190
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
191
+ # will be added to the HTTP request.
192
+ #
193
+ # @return [Concurrent::Promise] promise which provides async access to http
194
+ # response.
195
+ #
196
+ def delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers:nil)
197
+ # Send request
198
+ promise = begin_delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers:custom_headers)
199
+
200
+ promise = promise.then do |response|
201
+ # Defining deserialization method.
202
+ deserialize_method = lambda do |parsed_response|
203
+ end
204
+
205
+ # Waiting for response.
206
+ @client.get_long_running_operation_result(response, deserialize_method)
207
+ end
208
+
209
+ promise
210
+ end
211
+
212
+ #
213
+ # Gets all relationship links in the hub.
214
+ #
215
+ # @param resource_group_name [String] The name of the resource group.
216
+ # @param hub_name [String] The name of the hub.
217
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
218
+ # will be added to the HTTP request.
219
+ #
220
+ # @return [Array<RelationshipLinkResourceFormat>] operation results.
221
+ #
222
+ def list_by_hub(resource_group_name, hub_name, custom_headers:nil)
223
+ first_page = list_by_hub_as_lazy(resource_group_name, hub_name, custom_headers:custom_headers)
224
+ first_page.get_all_items
225
+ end
226
+
227
+ #
228
+ # Gets all relationship links in the hub.
229
+ #
230
+ # @param resource_group_name [String] The name of the resource group.
231
+ # @param hub_name [String] The name of the hub.
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 list_by_hub_with_http_info(resource_group_name, hub_name, custom_headers:nil)
238
+ list_by_hub_async(resource_group_name, hub_name, custom_headers:custom_headers).value!
239
+ end
240
+
241
+ #
242
+ # Gets all relationship links in the hub.
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 [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 list_by_hub_async(resource_group_name, hub_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, '@client.api_version is nil' if @client.api_version.nil?
255
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
256
+
257
+
258
+ request_headers = {}
259
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
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}/relationshipLinks'
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,'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(:get, 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 == 200
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
+ # Deserialize Response
288
+ if status_code == 200
289
+ begin
290
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
291
+ result_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipLinkListResult.mapper()
292
+ result.body = @client.deserialize(result_mapper, parsed_response)
293
+ rescue Exception => e
294
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
295
+ end
296
+ end
297
+
298
+ result
299
+ end
300
+
301
+ promise.execute
302
+ end
303
+
304
+ #
305
+ # Creates a relationship link or updates an existing relationship link within a
306
+ # hub.
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 relationship_link_name [String] The name of the relationship link.
311
+ # @param parameters [RelationshipLinkResourceFormat] Parameters supplied to the
312
+ # CreateOrUpdate relationship link operation.
313
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
314
+ # will be added to the HTTP request.
315
+ #
316
+ # @return [RelationshipLinkResourceFormat] operation results.
317
+ #
318
+ def begin_create_or_update(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers:nil)
319
+ response = begin_create_or_update_async(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers:custom_headers).value!
320
+ response.body unless response.nil?
321
+ end
322
+
323
+ #
324
+ # Creates a relationship link or updates an existing relationship link within a
325
+ # hub.
326
+ #
327
+ # @param resource_group_name [String] The name of the resource group.
328
+ # @param hub_name [String] The name of the hub.
329
+ # @param relationship_link_name [String] The name of the relationship link.
330
+ # @param parameters [RelationshipLinkResourceFormat] Parameters supplied to the
331
+ # CreateOrUpdate relationship link operation.
332
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
333
+ # will be added to the HTTP request.
334
+ #
335
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
336
+ #
337
+ def begin_create_or_update_with_http_info(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers:nil)
338
+ begin_create_or_update_async(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers:custom_headers).value!
339
+ end
340
+
341
+ #
342
+ # Creates a relationship link or updates an existing relationship link within a
343
+ # hub.
344
+ #
345
+ # @param resource_group_name [String] The name of the resource group.
346
+ # @param hub_name [String] The name of the hub.
347
+ # @param relationship_link_name [String] The name of the relationship link.
348
+ # @param parameters [RelationshipLinkResourceFormat] Parameters supplied to the
349
+ # CreateOrUpdate relationship link operation.
350
+ # @param [Hash{String => String}] A hash of custom headers that will be added
351
+ # to the HTTP request.
352
+ #
353
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
354
+ #
355
+ def begin_create_or_update_async(resource_group_name, hub_name, relationship_link_name, parameters, custom_headers:nil)
356
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
357
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
358
+ fail ArgumentError, 'relationship_link_name is nil' if relationship_link_name.nil?
359
+ fail ArgumentError, "'relationship_link_name' should satisfy the constraint - 'MaxLength': '512'" if !relationship_link_name.nil? && relationship_link_name.length > 512
360
+ fail ArgumentError, "'relationship_link_name' should satisfy the constraint - 'MinLength': '1'" if !relationship_link_name.nil? && relationship_link_name.length < 1
361
+ fail ArgumentError, "'relationship_link_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z][a-zA-Z0-9_]+$'" if !relationship_link_name.nil? && relationship_link_name.match(Regexp.new('^^[a-zA-Z][a-zA-Z0-9_]+$$')).nil?
362
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
363
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
364
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
365
+
366
+
367
+ request_headers = {}
368
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
369
+
370
+ # Set Headers
371
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
372
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
373
+
374
+ # Serialize Request
375
+ request_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipLinkResourceFormat.mapper()
376
+ request_content = @client.serialize(request_mapper, parameters)
377
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
378
+
379
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}'
380
+
381
+ request_url = @base_url || @client.base_url
382
+
383
+ options = {
384
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
385
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'relationshipLinkName' => relationship_link_name,'subscriptionId' => @client.subscription_id},
386
+ query_params: {'api-version' => @client.api_version},
387
+ body: request_content,
388
+ headers: request_headers.merge(custom_headers || {}),
389
+ base_url: request_url
390
+ }
391
+ promise = @client.make_request_async(:put, path_template, options)
392
+
393
+ promise = promise.then do |result|
394
+ http_response = result.response
395
+ status_code = http_response.status
396
+ response_content = http_response.body
397
+ unless status_code == 200 || status_code == 202
398
+ error_model = JSON.load(response_content)
399
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
400
+ end
401
+
402
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
403
+ # Deserialize Response
404
+ if status_code == 200
405
+ begin
406
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
407
+ result_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipLinkResourceFormat.mapper()
408
+ result.body = @client.deserialize(result_mapper, parsed_response)
409
+ rescue Exception => e
410
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
411
+ end
412
+ end
413
+
414
+ result
415
+ end
416
+
417
+ promise.execute
418
+ end
419
+
420
+ #
421
+ # Deletes a relationship link within a 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 relationship_link_name [String] The name of the relationship.
426
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
427
+ # will be added to the HTTP request.
428
+ #
429
+ #
430
+ def begin_delete(resource_group_name, hub_name, relationship_link_name, custom_headers:nil)
431
+ response = begin_delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers:custom_headers).value!
432
+ nil
433
+ end
434
+
435
+ #
436
+ # Deletes a relationship link within a hub.
437
+ #
438
+ # @param resource_group_name [String] The name of the resource group.
439
+ # @param hub_name [String] The name of the hub.
440
+ # @param relationship_link_name [String] The name of the relationship.
441
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
442
+ # will be added to the HTTP request.
443
+ #
444
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
445
+ #
446
+ def begin_delete_with_http_info(resource_group_name, hub_name, relationship_link_name, custom_headers:nil)
447
+ begin_delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers:custom_headers).value!
448
+ end
449
+
450
+ #
451
+ # Deletes a relationship link within a hub.
452
+ #
453
+ # @param resource_group_name [String] The name of the resource group.
454
+ # @param hub_name [String] The name of the hub.
455
+ # @param relationship_link_name [String] The name of the relationship.
456
+ # @param [Hash{String => String}] A hash of custom headers that will be added
457
+ # to the HTTP request.
458
+ #
459
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
460
+ #
461
+ def begin_delete_async(resource_group_name, hub_name, relationship_link_name, custom_headers:nil)
462
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
463
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
464
+ fail ArgumentError, 'relationship_link_name is nil' if relationship_link_name.nil?
465
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
466
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
467
+
468
+
469
+ request_headers = {}
470
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
471
+
472
+ # Set Headers
473
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
474
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
475
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}'
476
+
477
+ request_url = @base_url || @client.base_url
478
+
479
+ options = {
480
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
481
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'relationshipLinkName' => relationship_link_name,'subscriptionId' => @client.subscription_id},
482
+ query_params: {'api-version' => @client.api_version},
483
+ headers: request_headers.merge(custom_headers || {}),
484
+ base_url: request_url
485
+ }
486
+ promise = @client.make_request_async(:delete, path_template, options)
487
+
488
+ promise = promise.then do |result|
489
+ http_response = result.response
490
+ status_code = http_response.status
491
+ response_content = http_response.body
492
+ unless status_code == 202 || status_code == 200
493
+ error_model = JSON.load(response_content)
494
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
495
+ end
496
+
497
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
498
+
499
+ result
500
+ end
501
+
502
+ promise.execute
503
+ end
504
+
505
+ #
506
+ # Gets all relationship links in the hub.
507
+ #
508
+ # @param next_page_link [String] The NextLink from the previous successful call
509
+ # to List operation.
510
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
511
+ # will be added to the HTTP request.
512
+ #
513
+ # @return [RelationshipLinkListResult] operation results.
514
+ #
515
+ def list_by_hub_next(next_page_link, custom_headers:nil)
516
+ response = list_by_hub_next_async(next_page_link, custom_headers:custom_headers).value!
517
+ response.body unless response.nil?
518
+ end
519
+
520
+ #
521
+ # Gets all relationship links in the hub.
522
+ #
523
+ # @param next_page_link [String] The NextLink from the previous successful call
524
+ # to List operation.
525
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
526
+ # will be added to the HTTP request.
527
+ #
528
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
529
+ #
530
+ def list_by_hub_next_with_http_info(next_page_link, custom_headers:nil)
531
+ list_by_hub_next_async(next_page_link, custom_headers:custom_headers).value!
532
+ end
533
+
534
+ #
535
+ # Gets all relationship links in the hub.
536
+ #
537
+ # @param next_page_link [String] The NextLink from the previous successful call
538
+ # to List operation.
539
+ # @param [Hash{String => String}] A hash of custom headers that will be added
540
+ # to the HTTP request.
541
+ #
542
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
543
+ #
544
+ def list_by_hub_next_async(next_page_link, custom_headers:nil)
545
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
546
+
547
+
548
+ request_headers = {}
549
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
550
+
551
+ # Set Headers
552
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
553
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
554
+ path_template = '{nextLink}'
555
+
556
+ request_url = @base_url || @client.base_url
557
+
558
+ options = {
559
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
560
+ skip_encoding_path_params: {'nextLink' => next_page_link},
561
+ headers: request_headers.merge(custom_headers || {}),
562
+ base_url: request_url
563
+ }
564
+ promise = @client.make_request_async(:get, path_template, options)
565
+
566
+ promise = promise.then do |result|
567
+ http_response = result.response
568
+ status_code = http_response.status
569
+ response_content = http_response.body
570
+ unless status_code == 200
571
+ error_model = JSON.load(response_content)
572
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
573
+ end
574
+
575
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
576
+ # Deserialize Response
577
+ if status_code == 200
578
+ begin
579
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
580
+ result_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipLinkListResult.mapper()
581
+ result.body = @client.deserialize(result_mapper, parsed_response)
582
+ rescue Exception => e
583
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
584
+ end
585
+ end
586
+
587
+ result
588
+ end
589
+
590
+ promise.execute
591
+ end
592
+
593
+ #
594
+ # Gets all relationship links in the hub.
595
+ #
596
+ # @param resource_group_name [String] The name of the resource group.
597
+ # @param hub_name [String] The name of the hub.
598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
599
+ # will be added to the HTTP request.
600
+ #
601
+ # @return [RelationshipLinkListResult] which provide lazy access to pages of
602
+ # the response.
603
+ #
604
+ def list_by_hub_as_lazy(resource_group_name, hub_name, custom_headers:nil)
605
+ response = list_by_hub_async(resource_group_name, hub_name, custom_headers:custom_headers).value!
606
+ unless response.nil?
607
+ page = response.body
608
+ page.next_method = Proc.new do |next_page_link|
609
+ list_by_hub_next_async(next_page_link, custom_headers:custom_headers)
610
+ end
611
+ page
612
+ end
613
+ end
614
+
615
+ end
616
+ end