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,612 @@
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 Relationships
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Relationships 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 or updates an existing relationship within a 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 relationship_name [String] The name of the Relationship.
33
+ # @param parameters [RelationshipResourceFormat] Parameters supplied to the
34
+ # CreateOrUpdate Relationship 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 [RelationshipResourceFormat] operation results.
39
+ #
40
+ def create_or_update(resource_group_name, hub_name, relationship_name, parameters, custom_headers:nil)
41
+ response = create_or_update_async(resource_group_name, hub_name, relationship_name, parameters, custom_headers: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 relationship_name [String] The name of the Relationship.
49
+ # @param parameters [RelationshipResourceFormat] Parameters supplied to the
50
+ # CreateOrUpdate Relationship 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, relationship_name, parameters, custom_headers:nil)
58
+ # Send request
59
+ promise = begin_create_or_update_async(resource_group_name, hub_name, relationship_name, parameters, custom_headers:custom_headers)
60
+
61
+ promise = promise.then do |response|
62
+ # Defining deserialization method.
63
+ deserialize_method = lambda do |parsed_response|
64
+ result_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipResourceFormat.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 information about the specified relationship.
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 relationship_name [String] The name of the relationship.
81
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
82
+ # will be added to the HTTP request.
83
+ #
84
+ # @return [RelationshipResourceFormat] operation results.
85
+ #
86
+ def get(resource_group_name, hub_name, relationship_name, custom_headers:nil)
87
+ response = get_async(resource_group_name, hub_name, relationship_name, custom_headers:custom_headers).value!
88
+ response.body unless response.nil?
89
+ end
90
+
91
+ #
92
+ # Gets information about the specified relationship.
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 relationship_name [String] The name of the relationship.
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, relationship_name, custom_headers:nil)
103
+ get_async(resource_group_name, hub_name, relationship_name, custom_headers:custom_headers).value!
104
+ end
105
+
106
+ #
107
+ # Gets information about the specified relationship.
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 relationship_name [String] The name of the relationship.
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, relationship_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, 'relationship_name is nil' if relationship_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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
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}/relationships/{relationshipName}'
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,'relationshipName' => relationship_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::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipResourceFormat.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 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_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_name, custom_headers:nil)
181
+ response = delete_async(resource_group_name, hub_name, relationship_name, custom_headers: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_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_name, custom_headers:nil)
196
+ # Send request
197
+ promise = begin_delete_async(resource_group_name, hub_name, relationship_name, custom_headers: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 relationships 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<RelationshipResourceFormat>] 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:custom_headers)
223
+ first_page.get_all_items
224
+ end
225
+
226
+ #
227
+ # Gets all relationships 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:custom_headers).value!
238
+ end
239
+
240
+ #
241
+ # Gets all relationships 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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
259
+
260
+ # Set Headers
261
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
262
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
263
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships'
264
+
265
+ request_url = @base_url || @client.base_url
266
+
267
+ options = {
268
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
269
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'subscriptionId' => @client.subscription_id},
270
+ query_params: {'api-version' => @client.api_version},
271
+ headers: request_headers.merge(custom_headers || {}),
272
+ base_url: request_url
273
+ }
274
+ promise = @client.make_request_async(:get, path_template, options)
275
+
276
+ promise = promise.then do |result|
277
+ http_response = result.response
278
+ status_code = http_response.status
279
+ response_content = http_response.body
280
+ unless status_code == 200
281
+ error_model = JSON.load(response_content)
282
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
283
+ end
284
+
285
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
286
+ # Deserialize Response
287
+ if status_code == 200
288
+ begin
289
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
290
+ result_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipListResult.mapper()
291
+ result.body = @client.deserialize(result_mapper, parsed_response)
292
+ rescue Exception => e
293
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
294
+ end
295
+ end
296
+
297
+ result
298
+ end
299
+
300
+ promise.execute
301
+ end
302
+
303
+ #
304
+ # Creates a relationship or updates an existing relationship within a 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_name [String] The name of the Relationship.
309
+ # @param parameters [RelationshipResourceFormat] Parameters supplied to the
310
+ # CreateOrUpdate Relationship 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 [RelationshipResourceFormat] operation results.
315
+ #
316
+ def begin_create_or_update(resource_group_name, hub_name, relationship_name, parameters, custom_headers:nil)
317
+ response = begin_create_or_update_async(resource_group_name, hub_name, relationship_name, parameters, custom_headers:custom_headers).value!
318
+ response.body unless response.nil?
319
+ end
320
+
321
+ #
322
+ # Creates a relationship or updates an existing relationship within a hub.
323
+ #
324
+ # @param resource_group_name [String] The name of the resource group.
325
+ # @param hub_name [String] The name of the hub.
326
+ # @param relationship_name [String] The name of the Relationship.
327
+ # @param parameters [RelationshipResourceFormat] Parameters supplied to the
328
+ # CreateOrUpdate Relationship operation.
329
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
330
+ # will be added to the HTTP request.
331
+ #
332
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
333
+ #
334
+ def begin_create_or_update_with_http_info(resource_group_name, hub_name, relationship_name, parameters, custom_headers:nil)
335
+ begin_create_or_update_async(resource_group_name, hub_name, relationship_name, parameters, custom_headers:custom_headers).value!
336
+ end
337
+
338
+ #
339
+ # Creates a relationship or updates an existing relationship within a hub.
340
+ #
341
+ # @param resource_group_name [String] The name of the resource group.
342
+ # @param hub_name [String] The name of the hub.
343
+ # @param relationship_name [String] The name of the Relationship.
344
+ # @param parameters [RelationshipResourceFormat] Parameters supplied to the
345
+ # CreateOrUpdate Relationship operation.
346
+ # @param [Hash{String => String}] A hash of custom headers that will be added
347
+ # to the HTTP request.
348
+ #
349
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
350
+ #
351
+ def begin_create_or_update_async(resource_group_name, hub_name, relationship_name, parameters, custom_headers:nil)
352
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
353
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
354
+ fail ArgumentError, 'relationship_name is nil' if relationship_name.nil?
355
+ fail ArgumentError, "'relationship_name' should satisfy the constraint - 'MaxLength': '512'" if !relationship_name.nil? && relationship_name.length > 512
356
+ fail ArgumentError, "'relationship_name' should satisfy the constraint - 'MinLength': '1'" if !relationship_name.nil? && relationship_name.length < 1
357
+ fail ArgumentError, "'relationship_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z][a-zA-Z0-9_]+$'" if !relationship_name.nil? && relationship_name.match(Regexp.new('^^[a-zA-Z][a-zA-Z0-9_]+$$')).nil?
358
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
359
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
360
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
361
+
362
+
363
+ request_headers = {}
364
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
365
+
366
+ # Set Headers
367
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
368
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
369
+
370
+ # Serialize Request
371
+ request_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipResourceFormat.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}/relationships/{relationshipName}'
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,'relationshipName' => relationship_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::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipResourceFormat.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 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_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_name, custom_headers:nil)
427
+ response = begin_delete_async(resource_group_name, hub_name, relationship_name, custom_headers:custom_headers).value!
428
+ nil
429
+ end
430
+
431
+ #
432
+ # Deletes a relationship 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_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_name, custom_headers:nil)
443
+ begin_delete_async(resource_group_name, hub_name, relationship_name, custom_headers:custom_headers).value!
444
+ end
445
+
446
+ #
447
+ # Deletes a relationship 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_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_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_name is nil' if relationship_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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
467
+
468
+ # Set Headers
469
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
470
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
471
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}'
472
+
473
+ request_url = @base_url || @client.base_url
474
+
475
+ options = {
476
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
477
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'relationshipName' => relationship_name,'subscriptionId' => @client.subscription_id},
478
+ query_params: {'api-version' => @client.api_version},
479
+ headers: request_headers.merge(custom_headers || {}),
480
+ base_url: request_url
481
+ }
482
+ promise = @client.make_request_async(:delete, path_template, options)
483
+
484
+ promise = promise.then do |result|
485
+ http_response = result.response
486
+ status_code = http_response.status
487
+ response_content = http_response.body
488
+ unless status_code == 202 || status_code == 200
489
+ error_model = JSON.load(response_content)
490
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
491
+ end
492
+
493
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
494
+
495
+ result
496
+ end
497
+
498
+ promise.execute
499
+ end
500
+
501
+ #
502
+ # Gets all relationships in the hub.
503
+ #
504
+ # @param next_page_link [String] The NextLink from the previous successful call
505
+ # to List operation.
506
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
507
+ # will be added to the HTTP request.
508
+ #
509
+ # @return [RelationshipListResult] operation results.
510
+ #
511
+ def list_by_hub_next(next_page_link, custom_headers:nil)
512
+ response = list_by_hub_next_async(next_page_link, custom_headers:custom_headers).value!
513
+ response.body unless response.nil?
514
+ end
515
+
516
+ #
517
+ # Gets all relationships in the hub.
518
+ #
519
+ # @param next_page_link [String] The NextLink from the previous successful call
520
+ # to List operation.
521
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
522
+ # will be added to the HTTP request.
523
+ #
524
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
525
+ #
526
+ def list_by_hub_next_with_http_info(next_page_link, custom_headers:nil)
527
+ list_by_hub_next_async(next_page_link, custom_headers:custom_headers).value!
528
+ end
529
+
530
+ #
531
+ # Gets all relationships in the hub.
532
+ #
533
+ # @param next_page_link [String] The NextLink from the previous successful call
534
+ # to List operation.
535
+ # @param [Hash{String => String}] A hash of custom headers that will be added
536
+ # to the HTTP request.
537
+ #
538
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
539
+ #
540
+ def list_by_hub_next_async(next_page_link, custom_headers:nil)
541
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
542
+
543
+
544
+ request_headers = {}
545
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
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 = '{nextLink}'
551
+
552
+ request_url = @base_url || @client.base_url
553
+
554
+ options = {
555
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
556
+ skip_encoding_path_params: {'nextLink' => next_page_link},
557
+ headers: request_headers.merge(custom_headers || {}),
558
+ base_url: request_url
559
+ }
560
+ promise = @client.make_request_async(:get, path_template, options)
561
+
562
+ promise = promise.then do |result|
563
+ http_response = result.response
564
+ status_code = http_response.status
565
+ response_content = http_response.body
566
+ unless status_code == 200
567
+ error_model = JSON.load(response_content)
568
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
569
+ end
570
+
571
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
572
+ # Deserialize Response
573
+ if status_code == 200
574
+ begin
575
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
576
+ result_mapper = Azure::CustomerInsights::Mgmt::V2017_01_01::Models::RelationshipListResult.mapper()
577
+ result.body = @client.deserialize(result_mapper, parsed_response)
578
+ rescue Exception => e
579
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
580
+ end
581
+ end
582
+
583
+ result
584
+ end
585
+
586
+ promise.execute
587
+ end
588
+
589
+ #
590
+ # Gets all relationships in the hub.
591
+ #
592
+ # @param resource_group_name [String] The name of the resource group.
593
+ # @param hub_name [String] The name of the hub.
594
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
595
+ # will be added to the HTTP request.
596
+ #
597
+ # @return [RelationshipListResult] which provide lazy access to pages of the
598
+ # response.
599
+ #
600
+ def list_by_hub_as_lazy(resource_group_name, hub_name, custom_headers:nil)
601
+ response = list_by_hub_async(resource_group_name, hub_name, custom_headers:custom_headers).value!
602
+ unless response.nil?
603
+ page = response.body
604
+ page.next_method = Proc.new do |next_page_link|
605
+ list_by_hub_next_async(next_page_link, custom_headers:custom_headers)
606
+ end
607
+ page
608
+ end
609
+ end
610
+
611
+ end
612
+ end