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,191 @@
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
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class CustomerInsightsManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Gets subscription credentials which uniquely identify
21
+ # Microsoft Azure subscription. The subscription ID forms part of the URI
22
+ # for every service call.
23
+ attr_accessor :subscription_id
24
+
25
+ # @return [String] Client Api Version.
26
+ attr_reader :api_version
27
+
28
+ # @return [String] Gets or sets the preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
32
+ # Running Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
36
+ # is generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return [Hubs] hubs
40
+ attr_reader :hubs
41
+
42
+ # @return [Profiles] profiles
43
+ attr_reader :profiles
44
+
45
+ # @return [Interactions] interactions
46
+ attr_reader :interactions
47
+
48
+ # @return [Relationships] relationships
49
+ attr_reader :relationships
50
+
51
+ # @return [RelationshipLinks] relationship_links
52
+ attr_reader :relationship_links
53
+
54
+ # @return [AuthorizationPolicies] authorization_policies
55
+ attr_reader :authorization_policies
56
+
57
+ # @return [Connectors] connectors
58
+ attr_reader :connectors
59
+
60
+ # @return [ConnectorMappings] connector_mappings
61
+ attr_reader :connector_mappings
62
+
63
+ # @return [Kpi] kpi
64
+ attr_reader :kpi
65
+
66
+ # @return [WidgetTypes] widget_types
67
+ attr_reader :widget_types
68
+
69
+ # @return [Views] views
70
+ attr_reader :views
71
+
72
+ # @return [Links] links
73
+ attr_reader :links
74
+
75
+ # @return [Roles] roles
76
+ attr_reader :roles
77
+
78
+ # @return [RoleAssignments] role_assignments
79
+ attr_reader :role_assignments
80
+
81
+ # @return [Images] images
82
+ attr_reader :images
83
+
84
+ # @return [Predictions] predictions
85
+ attr_reader :predictions
86
+
87
+ #
88
+ # Creates initializes a new instance of the CustomerInsightsManagementClient class.
89
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
90
+ # @param base_url [String] the base URI of the service.
91
+ # @param options [Array] filters to be applied to the HTTP requests.
92
+ #
93
+ def initialize(credentials = nil, base_url = nil, options = nil)
94
+ super(credentials, options)
95
+ @base_url = base_url || 'https://management.azure.com'
96
+
97
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
98
+ @credentials = credentials
99
+
100
+ @hubs = Hubs.new(self)
101
+ @profiles = Profiles.new(self)
102
+ @interactions = Interactions.new(self)
103
+ @relationships = Relationships.new(self)
104
+ @relationship_links = RelationshipLinks.new(self)
105
+ @authorization_policies = AuthorizationPolicies.new(self)
106
+ @connectors = Connectors.new(self)
107
+ @connector_mappings = ConnectorMappings.new(self)
108
+ @kpi = Kpi.new(self)
109
+ @widget_types = WidgetTypes.new(self)
110
+ @views = Views.new(self)
111
+ @links = Links.new(self)
112
+ @roles = Roles.new(self)
113
+ @role_assignments = RoleAssignments.new(self)
114
+ @images = Images.new(self)
115
+ @predictions = Predictions.new(self)
116
+ @api_version = '2017-04-26'
117
+ @accept_language = 'en-US'
118
+ @long_running_operation_retry_timeout = 30
119
+ @generate_client_request_id = true
120
+ add_telemetry
121
+ end
122
+
123
+ #
124
+ # Makes a request and returns the body of the response.
125
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
126
+ # @param path [String] the path, relative to {base_url}.
127
+ # @param options [Hash{String=>String}] specifying any request options like :body.
128
+ # @return [Hash{String=>String}] containing the body of the response.
129
+ # Example:
130
+ #
131
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
132
+ # path = "/path"
133
+ # options = {
134
+ # body: request_content,
135
+ # query_params: {'api-version' => '2016-02-01'}
136
+ # }
137
+ # result = @client.make_request(:put, path, options)
138
+ #
139
+ def make_request(method, path, options = {})
140
+ result = make_request_with_http_info(method, path, options)
141
+ result.body unless result.nil?
142
+ end
143
+
144
+ #
145
+ # Makes a request and returns the operation response.
146
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
147
+ # @param path [String] the path, relative to {base_url}.
148
+ # @param options [Hash{String=>String}] specifying any request options like :body.
149
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
150
+ #
151
+ def make_request_with_http_info(method, path, options = {})
152
+ result = make_request_async(method, path, options).value!
153
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
154
+ result
155
+ end
156
+
157
+ #
158
+ # Makes a request asynchronously.
159
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
160
+ # @param path [String] the path, relative to {base_url}.
161
+ # @param options [Hash{String=>String}] specifying any request options like :body.
162
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
163
+ #
164
+ def make_request_async(method, path, options = {})
165
+ fail ArgumentError, 'method is nil' if method.nil?
166
+ fail ArgumentError, 'path is nil' if path.nil?
167
+
168
+ request_url = options[:base_url] || @base_url
169
+
170
+ request_headers = @request_headers
171
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
172
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
173
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
174
+
175
+ super(request_url, method, path, options)
176
+ end
177
+
178
+
179
+ private
180
+ #
181
+ # Adds telemetry information.
182
+ #
183
+ def add_telemetry
184
+ sdk_information = 'azure_mgmt_customer_insights'
185
+ if defined? Azure::ARM::CustomerInsights::VERSION
186
+ sdk_information = "#{sdk_information}/#{Azure::ARM::CustomerInsights::VERSION}"
187
+ end
188
+ add_user_agent_information(sdk_information)
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,841 @@
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 Hubs
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Hubs 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 hub, or updates an existing 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 parameters [Hub] Parameters supplied to the CreateOrUpdate Hub
33
+ # operation.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [Hub] operation results.
38
+ #
39
+ def create_or_update(resource_group_name, hub_name, parameters, custom_headers = nil)
40
+ response = create_or_update_async(resource_group_name, hub_name, parameters, custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Creates a hub, or updates an existing hub.
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 parameters [Hub] Parameters supplied to the CreateOrUpdate Hub
50
+ # 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 [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def create_or_update_with_http_info(resource_group_name, hub_name, parameters, custom_headers = nil)
57
+ create_or_update_async(resource_group_name, hub_name, parameters, custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Creates a hub, or updates an existing hub.
62
+ #
63
+ # @param resource_group_name [String] The name of the resource group.
64
+ # @param hub_name [String] The name of the Hub.
65
+ # @param parameters [Hub] Parameters supplied to the CreateOrUpdate Hub
66
+ # operation.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def create_or_update_async(resource_group_name, hub_name, parameters, custom_headers = nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
75
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
76
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
78
+
79
+
80
+ request_headers = {}
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+
86
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
87
+
88
+ # Serialize Request
89
+ request_mapper = Azure::ARM::CustomerInsights::Models::Hub.mapper()
90
+ request_content = @client.serialize(request_mapper, parameters)
91
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
92
+
93
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}'
94
+
95
+ request_url = @base_url || @client.base_url
96
+
97
+ options = {
98
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
99
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'subscriptionId' => @client.subscription_id},
100
+ query_params: {'api-version' => @client.api_version},
101
+ body: request_content,
102
+ headers: request_headers.merge(custom_headers || {}),
103
+ base_url: request_url
104
+ }
105
+ promise = @client.make_request_async(:put, path_template, options)
106
+
107
+ promise = promise.then do |result|
108
+ http_response = result.response
109
+ status_code = http_response.status
110
+ response_content = http_response.body
111
+ unless status_code == 201 || status_code == 200
112
+ error_model = JSON.load(response_content)
113
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
114
+ end
115
+
116
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
117
+ # Deserialize Response
118
+ if status_code == 201
119
+ begin
120
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
121
+ result_mapper = Azure::ARM::CustomerInsights::Models::Hub.mapper()
122
+ result.body = @client.deserialize(result_mapper, parsed_response)
123
+ rescue Exception => e
124
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
125
+ end
126
+ end
127
+ # Deserialize Response
128
+ if status_code == 200
129
+ begin
130
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
131
+ result_mapper = Azure::ARM::CustomerInsights::Models::Hub.mapper()
132
+ result.body = @client.deserialize(result_mapper, parsed_response)
133
+ rescue Exception => e
134
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
135
+ end
136
+ end
137
+
138
+ result
139
+ end
140
+
141
+ promise.execute
142
+ end
143
+
144
+ #
145
+ # Updates a Hub.
146
+ #
147
+ # @param resource_group_name [String] The name of the resource group.
148
+ # @param hub_name [String] The name of the Hub.
149
+ # @param parameters [Hub] Parameters supplied to the Update Hub operation.
150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
151
+ # will be added to the HTTP request.
152
+ #
153
+ # @return [Hub] operation results.
154
+ #
155
+ def update(resource_group_name, hub_name, parameters, custom_headers = nil)
156
+ response = update_async(resource_group_name, hub_name, parameters, custom_headers).value!
157
+ response.body unless response.nil?
158
+ end
159
+
160
+ #
161
+ # Updates a Hub.
162
+ #
163
+ # @param resource_group_name [String] The name of the resource group.
164
+ # @param hub_name [String] The name of the Hub.
165
+ # @param parameters [Hub] Parameters supplied to the Update Hub operation.
166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
167
+ # will be added to the HTTP request.
168
+ #
169
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
170
+ #
171
+ def update_with_http_info(resource_group_name, hub_name, parameters, custom_headers = nil)
172
+ update_async(resource_group_name, hub_name, parameters, custom_headers).value!
173
+ end
174
+
175
+ #
176
+ # Updates a Hub.
177
+ #
178
+ # @param resource_group_name [String] The name of the resource group.
179
+ # @param hub_name [String] The name of the Hub.
180
+ # @param parameters [Hub] Parameters supplied to the Update Hub operation.
181
+ # @param [Hash{String => String}] A hash of custom headers that will be added
182
+ # to the HTTP request.
183
+ #
184
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
185
+ #
186
+ def update_async(resource_group_name, hub_name, parameters, custom_headers = nil)
187
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
188
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
189
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
190
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
191
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
192
+
193
+
194
+ request_headers = {}
195
+
196
+ # Set Headers
197
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
198
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
199
+
200
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
201
+
202
+ # Serialize Request
203
+ request_mapper = Azure::ARM::CustomerInsights::Models::Hub.mapper()
204
+ request_content = @client.serialize(request_mapper, parameters)
205
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
206
+
207
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}'
208
+
209
+ request_url = @base_url || @client.base_url
210
+
211
+ options = {
212
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
213
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'subscriptionId' => @client.subscription_id},
214
+ query_params: {'api-version' => @client.api_version},
215
+ body: request_content,
216
+ headers: request_headers.merge(custom_headers || {}),
217
+ base_url: request_url
218
+ }
219
+ promise = @client.make_request_async(:patch, path_template, options)
220
+
221
+ promise = promise.then do |result|
222
+ http_response = result.response
223
+ status_code = http_response.status
224
+ response_content = http_response.body
225
+ unless status_code == 200
226
+ error_model = JSON.load(response_content)
227
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
228
+ end
229
+
230
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
231
+ # Deserialize Response
232
+ if status_code == 200
233
+ begin
234
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
235
+ result_mapper = Azure::ARM::CustomerInsights::Models::Hub.mapper()
236
+ result.body = @client.deserialize(result_mapper, parsed_response)
237
+ rescue Exception => e
238
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
239
+ end
240
+ end
241
+
242
+ result
243
+ end
244
+
245
+ promise.execute
246
+ end
247
+
248
+ #
249
+ # Deletes the specified hub.
250
+ #
251
+ # @param resource_group_name [String] The name of the resource group.
252
+ # @param hub_name [String] The name of the hub.
253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
254
+ # will be added to the HTTP request.
255
+ #
256
+ def delete(resource_group_name, hub_name, custom_headers = nil)
257
+ response = delete_async(resource_group_name, hub_name, custom_headers).value!
258
+ nil
259
+ end
260
+
261
+ #
262
+ # @param resource_group_name [String] The name of the resource group.
263
+ # @param hub_name [String] The name of the hub.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ # @return [Concurrent::Promise] promise which provides async access to http
268
+ # response.
269
+ #
270
+ def delete_async(resource_group_name, hub_name, custom_headers = nil)
271
+ # Send request
272
+ promise = begin_delete_async(resource_group_name, hub_name, custom_headers)
273
+
274
+ promise = promise.then do |response|
275
+ # Defining deserialization method.
276
+ deserialize_method = lambda do |parsed_response|
277
+ end
278
+
279
+ # Waiting for response.
280
+ @client.get_long_running_operation_result(response, deserialize_method)
281
+ end
282
+
283
+ promise
284
+ end
285
+
286
+ #
287
+ # Gets information about the specified hub.
288
+ #
289
+ # @param resource_group_name [String] The name of the resource group.
290
+ # @param hub_name [String] The name of the hub.
291
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
292
+ # will be added to the HTTP request.
293
+ #
294
+ # @return [Hub] operation results.
295
+ #
296
+ def get(resource_group_name, hub_name, custom_headers = nil)
297
+ response = get_async(resource_group_name, hub_name, custom_headers).value!
298
+ response.body unless response.nil?
299
+ end
300
+
301
+ #
302
+ # Gets information about the specified hub.
303
+ #
304
+ # @param resource_group_name [String] The name of the resource group.
305
+ # @param hub_name [String] The name of the hub.
306
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
307
+ # will be added to the HTTP request.
308
+ #
309
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
310
+ #
311
+ def get_with_http_info(resource_group_name, hub_name, custom_headers = nil)
312
+ get_async(resource_group_name, hub_name, custom_headers).value!
313
+ end
314
+
315
+ #
316
+ # Gets information about the specified hub.
317
+ #
318
+ # @param resource_group_name [String] The name of the resource group.
319
+ # @param hub_name [String] The name of the hub.
320
+ # @param [Hash{String => String}] A hash of custom headers that will be added
321
+ # to the HTTP request.
322
+ #
323
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
324
+ #
325
+ def get_async(resource_group_name, hub_name, custom_headers = nil)
326
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
327
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
328
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
329
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
330
+
331
+
332
+ request_headers = {}
333
+
334
+ # Set Headers
335
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
336
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
337
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}'
338
+
339
+ request_url = @base_url || @client.base_url
340
+
341
+ options = {
342
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
343
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'subscriptionId' => @client.subscription_id},
344
+ query_params: {'api-version' => @client.api_version},
345
+ headers: request_headers.merge(custom_headers || {}),
346
+ base_url: request_url
347
+ }
348
+ promise = @client.make_request_async(:get, path_template, options)
349
+
350
+ promise = promise.then do |result|
351
+ http_response = result.response
352
+ status_code = http_response.status
353
+ response_content = http_response.body
354
+ unless status_code == 200
355
+ error_model = JSON.load(response_content)
356
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
357
+ end
358
+
359
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
360
+ # Deserialize Response
361
+ if status_code == 200
362
+ begin
363
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
364
+ result_mapper = Azure::ARM::CustomerInsights::Models::Hub.mapper()
365
+ result.body = @client.deserialize(result_mapper, parsed_response)
366
+ rescue Exception => e
367
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
368
+ end
369
+ end
370
+
371
+ result
372
+ end
373
+
374
+ promise.execute
375
+ end
376
+
377
+ #
378
+ # Gets all the hubs in a resource group.
379
+ #
380
+ # @param resource_group_name [String] The name of the resource group.
381
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
382
+ # will be added to the HTTP request.
383
+ #
384
+ # @return [Array<Hub>] operation results.
385
+ #
386
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
387
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
388
+ first_page.get_all_items
389
+ end
390
+
391
+ #
392
+ # Gets all the hubs in a resource group.
393
+ #
394
+ # @param resource_group_name [String] The name of the resource group.
395
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
396
+ # will be added to the HTTP request.
397
+ #
398
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
399
+ #
400
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
401
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
402
+ end
403
+
404
+ #
405
+ # Gets all the hubs in a resource group.
406
+ #
407
+ # @param resource_group_name [String] The name of the resource group.
408
+ # @param [Hash{String => String}] A hash of custom headers that will be added
409
+ # to the HTTP request.
410
+ #
411
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
412
+ #
413
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
414
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
415
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
416
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
417
+
418
+
419
+ request_headers = {}
420
+
421
+ # Set Headers
422
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
423
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
424
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs'
425
+
426
+ request_url = @base_url || @client.base_url
427
+
428
+ options = {
429
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
430
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
431
+ query_params: {'api-version' => @client.api_version},
432
+ headers: request_headers.merge(custom_headers || {}),
433
+ base_url: request_url
434
+ }
435
+ promise = @client.make_request_async(:get, path_template, options)
436
+
437
+ promise = promise.then do |result|
438
+ http_response = result.response
439
+ status_code = http_response.status
440
+ response_content = http_response.body
441
+ unless status_code == 200
442
+ error_model = JSON.load(response_content)
443
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
444
+ end
445
+
446
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
447
+ # Deserialize Response
448
+ if status_code == 200
449
+ begin
450
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
451
+ result_mapper = Azure::ARM::CustomerInsights::Models::HubListResult.mapper()
452
+ result.body = @client.deserialize(result_mapper, parsed_response)
453
+ rescue Exception => e
454
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
455
+ end
456
+ end
457
+
458
+ result
459
+ end
460
+
461
+ promise.execute
462
+ end
463
+
464
+ #
465
+ # Gets all hubs in the specified subscription.
466
+ #
467
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
468
+ # will be added to the HTTP request.
469
+ #
470
+ # @return [Array<Hub>] operation results.
471
+ #
472
+ def list(custom_headers = nil)
473
+ first_page = list_as_lazy(custom_headers)
474
+ first_page.get_all_items
475
+ end
476
+
477
+ #
478
+ # Gets all hubs in the specified subscription.
479
+ #
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
484
+ #
485
+ def list_with_http_info(custom_headers = nil)
486
+ list_async(custom_headers).value!
487
+ end
488
+
489
+ #
490
+ # Gets all hubs in the specified subscription.
491
+ #
492
+ # @param [Hash{String => String}] A hash of custom headers that will be added
493
+ # to the HTTP request.
494
+ #
495
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
496
+ #
497
+ def list_async(custom_headers = nil)
498
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
499
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
500
+
501
+
502
+ request_headers = {}
503
+
504
+ # Set Headers
505
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
506
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
507
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.CustomerInsights/hubs'
508
+
509
+ request_url = @base_url || @client.base_url
510
+
511
+ options = {
512
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
513
+ path_params: {'subscriptionId' => @client.subscription_id},
514
+ query_params: {'api-version' => @client.api_version},
515
+ headers: request_headers.merge(custom_headers || {}),
516
+ base_url: request_url
517
+ }
518
+ promise = @client.make_request_async(:get, path_template, options)
519
+
520
+ promise = promise.then do |result|
521
+ http_response = result.response
522
+ status_code = http_response.status
523
+ response_content = http_response.body
524
+ unless status_code == 200
525
+ error_model = JSON.load(response_content)
526
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
527
+ end
528
+
529
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
530
+ # Deserialize Response
531
+ if status_code == 200
532
+ begin
533
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
534
+ result_mapper = Azure::ARM::CustomerInsights::Models::HubListResult.mapper()
535
+ result.body = @client.deserialize(result_mapper, parsed_response)
536
+ rescue Exception => e
537
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
538
+ end
539
+ end
540
+
541
+ result
542
+ end
543
+
544
+ promise.execute
545
+ end
546
+
547
+ #
548
+ # Deletes the specified hub.
549
+ #
550
+ # @param resource_group_name [String] The name of the resource group.
551
+ # @param hub_name [String] The name of the hub.
552
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
553
+ # will be added to the HTTP request.
554
+ #
555
+ #
556
+ def begin_delete(resource_group_name, hub_name, custom_headers = nil)
557
+ response = begin_delete_async(resource_group_name, hub_name, custom_headers).value!
558
+ nil
559
+ end
560
+
561
+ #
562
+ # Deletes the specified hub.
563
+ #
564
+ # @param resource_group_name [String] The name of the resource group.
565
+ # @param hub_name [String] The name of the hub.
566
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
567
+ # will be added to the HTTP request.
568
+ #
569
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
570
+ #
571
+ def begin_delete_with_http_info(resource_group_name, hub_name, custom_headers = nil)
572
+ begin_delete_async(resource_group_name, hub_name, custom_headers).value!
573
+ end
574
+
575
+ #
576
+ # Deletes the specified hub.
577
+ #
578
+ # @param resource_group_name [String] The name of the resource group.
579
+ # @param hub_name [String] The name of the hub.
580
+ # @param [Hash{String => String}] A hash of custom headers that will be added
581
+ # to the HTTP request.
582
+ #
583
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
584
+ #
585
+ def begin_delete_async(resource_group_name, hub_name, custom_headers = nil)
586
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
587
+ fail ArgumentError, 'hub_name is nil' if hub_name.nil?
588
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
589
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
590
+
591
+
592
+ request_headers = {}
593
+
594
+ # Set Headers
595
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
596
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
597
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}'
598
+
599
+ request_url = @base_url || @client.base_url
600
+
601
+ options = {
602
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
603
+ path_params: {'resourceGroupName' => resource_group_name,'hubName' => hub_name,'subscriptionId' => @client.subscription_id},
604
+ query_params: {'api-version' => @client.api_version},
605
+ headers: request_headers.merge(custom_headers || {}),
606
+ base_url: request_url
607
+ }
608
+ promise = @client.make_request_async(:delete, path_template, options)
609
+
610
+ promise = promise.then do |result|
611
+ http_response = result.response
612
+ status_code = http_response.status
613
+ response_content = http_response.body
614
+ unless status_code == 200 || status_code == 202 || status_code == 204
615
+ error_model = JSON.load(response_content)
616
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
617
+ end
618
+
619
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
620
+
621
+ result
622
+ end
623
+
624
+ promise.execute
625
+ end
626
+
627
+ #
628
+ # Gets all the hubs in a resource group.
629
+ #
630
+ # @param next_page_link [String] The NextLink from the previous successful call
631
+ # to List operation.
632
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
633
+ # will be added to the HTTP request.
634
+ #
635
+ # @return [HubListResult] operation results.
636
+ #
637
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
638
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
639
+ response.body unless response.nil?
640
+ end
641
+
642
+ #
643
+ # Gets all the hubs in a resource group.
644
+ #
645
+ # @param next_page_link [String] The NextLink from the previous successful call
646
+ # to List operation.
647
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
648
+ # will be added to the HTTP request.
649
+ #
650
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
651
+ #
652
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
653
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
654
+ end
655
+
656
+ #
657
+ # Gets all the hubs in a resource group.
658
+ #
659
+ # @param next_page_link [String] The NextLink from the previous successful call
660
+ # to List operation.
661
+ # @param [Hash{String => String}] A hash of custom headers that will be added
662
+ # to the HTTP request.
663
+ #
664
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
665
+ #
666
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
667
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
668
+
669
+
670
+ request_headers = {}
671
+
672
+ # Set Headers
673
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
674
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
675
+ path_template = '{nextLink}'
676
+
677
+ request_url = @base_url || @client.base_url
678
+
679
+ options = {
680
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
681
+ skip_encoding_path_params: {'nextLink' => next_page_link},
682
+ headers: request_headers.merge(custom_headers || {}),
683
+ base_url: request_url
684
+ }
685
+ promise = @client.make_request_async(:get, path_template, options)
686
+
687
+ promise = promise.then do |result|
688
+ http_response = result.response
689
+ status_code = http_response.status
690
+ response_content = http_response.body
691
+ unless status_code == 200
692
+ error_model = JSON.load(response_content)
693
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
694
+ end
695
+
696
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
697
+ # Deserialize Response
698
+ if status_code == 200
699
+ begin
700
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
701
+ result_mapper = Azure::ARM::CustomerInsights::Models::HubListResult.mapper()
702
+ result.body = @client.deserialize(result_mapper, parsed_response)
703
+ rescue Exception => e
704
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
705
+ end
706
+ end
707
+
708
+ result
709
+ end
710
+
711
+ promise.execute
712
+ end
713
+
714
+ #
715
+ # Gets all hubs in the specified subscription.
716
+ #
717
+ # @param next_page_link [String] The NextLink from the previous successful call
718
+ # to List operation.
719
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
720
+ # will be added to the HTTP request.
721
+ #
722
+ # @return [HubListResult] operation results.
723
+ #
724
+ def list_next(next_page_link, custom_headers = nil)
725
+ response = list_next_async(next_page_link, custom_headers).value!
726
+ response.body unless response.nil?
727
+ end
728
+
729
+ #
730
+ # Gets all hubs in the specified subscription.
731
+ #
732
+ # @param next_page_link [String] The NextLink from the previous successful call
733
+ # to List operation.
734
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
735
+ # will be added to the HTTP request.
736
+ #
737
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
738
+ #
739
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
740
+ list_next_async(next_page_link, custom_headers).value!
741
+ end
742
+
743
+ #
744
+ # Gets all hubs in the specified subscription.
745
+ #
746
+ # @param next_page_link [String] The NextLink from the previous successful call
747
+ # to List operation.
748
+ # @param [Hash{String => String}] A hash of custom headers that will be added
749
+ # to the HTTP request.
750
+ #
751
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
752
+ #
753
+ def list_next_async(next_page_link, custom_headers = nil)
754
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
755
+
756
+
757
+ request_headers = {}
758
+
759
+ # Set Headers
760
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
761
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
762
+ path_template = '{nextLink}'
763
+
764
+ request_url = @base_url || @client.base_url
765
+
766
+ options = {
767
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
768
+ skip_encoding_path_params: {'nextLink' => next_page_link},
769
+ headers: request_headers.merge(custom_headers || {}),
770
+ base_url: request_url
771
+ }
772
+ promise = @client.make_request_async(:get, path_template, options)
773
+
774
+ promise = promise.then do |result|
775
+ http_response = result.response
776
+ status_code = http_response.status
777
+ response_content = http_response.body
778
+ unless status_code == 200
779
+ error_model = JSON.load(response_content)
780
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
781
+ end
782
+
783
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
784
+ # Deserialize Response
785
+ if status_code == 200
786
+ begin
787
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
788
+ result_mapper = Azure::ARM::CustomerInsights::Models::HubListResult.mapper()
789
+ result.body = @client.deserialize(result_mapper, parsed_response)
790
+ rescue Exception => e
791
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
792
+ end
793
+ end
794
+
795
+ result
796
+ end
797
+
798
+ promise.execute
799
+ end
800
+
801
+ #
802
+ # Gets all the hubs in a resource group.
803
+ #
804
+ # @param resource_group_name [String] The name of the resource group.
805
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
806
+ # will be added to the HTTP request.
807
+ #
808
+ # @return [HubListResult] which provide lazy access to pages of the response.
809
+ #
810
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
811
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
812
+ unless response.nil?
813
+ page = response.body
814
+ page.next_method = Proc.new do |next_page_link|
815
+ list_by_resource_group_next_async(next_page_link, custom_headers)
816
+ end
817
+ page
818
+ end
819
+ end
820
+
821
+ #
822
+ # Gets all hubs in the specified subscription.
823
+ #
824
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
825
+ # will be added to the HTTP request.
826
+ #
827
+ # @return [HubListResult] which provide lazy access to pages of the response.
828
+ #
829
+ def list_as_lazy(custom_headers = nil)
830
+ response = list_async(custom_headers).value!
831
+ unless response.nil?
832
+ page = response.body
833
+ page.next_method = Proc.new do |next_page_link|
834
+ list_next_async(next_page_link, custom_headers)
835
+ end
836
+ page
837
+ end
838
+ end
839
+
840
+ end
841
+ end