azure_mgmt_iot_hub 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_iot_hub.gemspec +34 -0
  6. data/lib/azure_mgmt_iot_hub.rb +5 -0
  7. data/lib/generated/azure_mgmt_iot_hub.rb +66 -0
  8. data/lib/generated/azure_mgmt_iot_hub/iot_hub_client.rb +66 -0
  9. data/lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb +2920 -0
  10. data/lib/generated/azure_mgmt_iot_hub/models/access_rights.rb +29 -0
  11. data/lib/generated/azure_mgmt_iot_hub/models/capabilities.rb +16 -0
  12. data/lib/generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb +71 -0
  13. data/lib/generated/azure_mgmt_iot_hub/models/error_details.rb +75 -0
  14. data/lib/generated/azure_mgmt_iot_hub/models/event_hub_consumer_group_info.rb +71 -0
  15. data/lib/generated/azure_mgmt_iot_hub/models/event_hub_consumer_groups_list_result.rb +93 -0
  16. data/lib/generated/azure_mgmt_iot_hub/models/event_hub_properties.rb +130 -0
  17. data/lib/generated/azure_mgmt_iot_hub/models/export_devices_request.rb +56 -0
  18. data/lib/generated/azure_mgmt_iot_hub/models/feedback_properties.rb +70 -0
  19. data/lib/generated/azure_mgmt_iot_hub/models/import_devices_request.rb +55 -0
  20. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_capacity.rb +80 -0
  21. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_description.rb +137 -0
  22. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_description_list_result.rb +94 -0
  23. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_name_availability_info.rb +67 -0
  24. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_name_unavailability_reason.rb +16 -0
  25. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb +177 -0
  26. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info.rb +64 -0
  27. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info_list_result.rb +95 -0
  28. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_scale_type.rb +17 -0
  29. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_sku.rb +18 -0
  30. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description.rb +67 -0
  31. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description_list_result.rb +94 -0
  32. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb +70 -0
  33. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_sku_tier.rb +16 -0
  34. data/lib/generated/azure_mgmt_iot_hub/models/job_response.rb +130 -0
  35. data/lib/generated/azure_mgmt_iot_hub/models/job_response_list_result.rb +94 -0
  36. data/lib/generated/azure_mgmt_iot_hub/models/job_status.rb +20 -0
  37. data/lib/generated/azure_mgmt_iot_hub/models/job_type.rb +24 -0
  38. data/lib/generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb +70 -0
  39. data/lib/generated/azure_mgmt_iot_hub/models/operation_inputs.rb +44 -0
  40. data/lib/generated/azure_mgmt_iot_hub/models/operation_monitoring_level.rb +17 -0
  41. data/lib/generated/azure_mgmt_iot_hub/models/operations_monitoring_properties.rb +51 -0
  42. data/lib/generated/azure_mgmt_iot_hub/models/registry_statistics.rb +64 -0
  43. data/lib/generated/azure_mgmt_iot_hub/models/sbaccess_rights.rb +18 -0
  44. data/lib/generated/azure_mgmt_iot_hub/models/shared_access_authorization_rule.rb +142 -0
  45. data/lib/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb +83 -0
  46. data/lib/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule_list_result.rb +98 -0
  47. data/lib/generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb +66 -0
  48. data/lib/generated/azure_mgmt_iot_hub/module_definition.rb +8 -0
  49. data/lib/generated/azure_mgmt_iot_hub/version.rb +8 -0
  50. metadata +162 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 217796eb890cbf27e2d3f3ea4ac161794d2c09f9
4
+ data.tar.gz: 49c0cb4e52d3f4cf9214b7bf750d279d790d2f41
5
+ SHA512:
6
+ metadata.gz: f7e8c654efa720802ad441bd4a1478d14ff3f31f7937417d98705758d5065a503c27041c79b297c7603749263df04b349309138dadcf89b57cb03e241f9000da
7
+ data.tar.gz: 9ebe1f72d18e00ebcfb03702840ca95425a1549b3927e618bf2041bee61091a4e659dc271e8970f418625f8ab8eddc94386250d2a8d1351dbca1f43478cf1d92
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require "bundler/gem_tasks"
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ lib = File.expand_path('../lib', __FILE__)
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+
8
+ require 'generated/azure_mgmt_iot_hub/module_definition'
9
+ require 'generated/azure_mgmt_iot_hub/version'
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = 'azure_mgmt_iot_hub'
13
+ spec.version = Azure::ARM::IotHub::VERSION
14
+ spec.authors = 'Microsoft Corporation'
15
+ spec.email = 'azrubyteam@microsoft.com'
16
+ spec.description = 'Microsoft Azure IoT Hub Management Client Library for Ruby'
17
+ spec.summary = 'Official Ruby client library to consume Microsoft Azure IoT Hub Management services.'
18
+ spec.homepage = 'https://aka.ms/azure-sdk-for-ruby'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = 'bin'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.required_ruby_version = '>= 1.9.3'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.9'
29
+ spec.add_development_dependency 'rake', '~> 10'
30
+ spec.add_development_dependency 'rspec', '~> 3'
31
+ spec.add_development_dependency 'dotenv', '~> 2'
32
+
33
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.4.0'
34
+ end
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require 'generated/azure_mgmt_iot_hub'
@@ -0,0 +1,66 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require 'generated/azure_mgmt_iot_hub/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::IotHub
23
+ autoload :IotHubResource, 'generated/azure_mgmt_iot_hub/iot_hub_resource.rb'
24
+ autoload :IotHubClient, 'generated/azure_mgmt_iot_hub/iot_hub_client.rb'
25
+
26
+ module Models
27
+ autoload :SharedAccessSignatureAuthorizationRule, 'generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb'
28
+ autoload :IotHubProperties, 'generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb'
29
+ autoload :EventHubProperties, 'generated/azure_mgmt_iot_hub/models/event_hub_properties.rb'
30
+ autoload :SharedAccessAuthorizationRule, 'generated/azure_mgmt_iot_hub/models/shared_access_authorization_rule.rb'
31
+ autoload :StorageEndpointProperties, 'generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb'
32
+ autoload :MessagingEndpointProperties, 'generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb'
33
+ autoload :CloudToDeviceProperties, 'generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb'
34
+ autoload :FeedbackProperties, 'generated/azure_mgmt_iot_hub/models/feedback_properties.rb'
35
+ autoload :OperationsMonitoringProperties, 'generated/azure_mgmt_iot_hub/models/operations_monitoring_properties.rb'
36
+ autoload :IotHubSkuInfo, 'generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb'
37
+ autoload :SharedAccessSignatureAuthorizationRuleListResult, 'generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule_list_result.rb'
38
+ autoload :ErrorDetails, 'generated/azure_mgmt_iot_hub/models/error_details.rb'
39
+ autoload :IotHubQuotaMetricInfoListResult, 'generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info_list_result.rb'
40
+ autoload :IotHubQuotaMetricInfo, 'generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info.rb'
41
+ autoload :RegistryStatistics, 'generated/azure_mgmt_iot_hub/models/registry_statistics.rb'
42
+ autoload :JobResponseListResult, 'generated/azure_mgmt_iot_hub/models/job_response_list_result.rb'
43
+ autoload :JobResponse, 'generated/azure_mgmt_iot_hub/models/job_response.rb'
44
+ autoload :IotHubSkuDescription, 'generated/azure_mgmt_iot_hub/models/iot_hub_sku_description.rb'
45
+ autoload :IotHubCapacity, 'generated/azure_mgmt_iot_hub/models/iot_hub_capacity.rb'
46
+ autoload :EventHubConsumerGroupsListResult, 'generated/azure_mgmt_iot_hub/models/event_hub_consumer_groups_list_result.rb'
47
+ autoload :EventHubConsumerGroupInfo, 'generated/azure_mgmt_iot_hub/models/event_hub_consumer_group_info.rb'
48
+ autoload :IotHubSkuDescriptionListResult, 'generated/azure_mgmt_iot_hub/models/iot_hub_sku_description_list_result.rb'
49
+ autoload :IotHubDescriptionListResult, 'generated/azure_mgmt_iot_hub/models/iot_hub_description_list_result.rb'
50
+ autoload :OperationInputs, 'generated/azure_mgmt_iot_hub/models/operation_inputs.rb'
51
+ autoload :IotHubNameAvailabilityInfo, 'generated/azure_mgmt_iot_hub/models/iot_hub_name_availability_info.rb'
52
+ autoload :ExportDevicesRequest, 'generated/azure_mgmt_iot_hub/models/export_devices_request.rb'
53
+ autoload :ImportDevicesRequest, 'generated/azure_mgmt_iot_hub/models/import_devices_request.rb'
54
+ autoload :IotHubDescription, 'generated/azure_mgmt_iot_hub/models/iot_hub_description.rb'
55
+ autoload :AccessRights, 'generated/azure_mgmt_iot_hub/models/access_rights.rb'
56
+ autoload :SBAccessRights, 'generated/azure_mgmt_iot_hub/models/sbaccess_rights.rb'
57
+ autoload :OperationMonitoringLevel, 'generated/azure_mgmt_iot_hub/models/operation_monitoring_level.rb'
58
+ autoload :Capabilities, 'generated/azure_mgmt_iot_hub/models/capabilities.rb'
59
+ autoload :IotHubSku, 'generated/azure_mgmt_iot_hub/models/iot_hub_sku.rb'
60
+ autoload :IotHubSkuTier, 'generated/azure_mgmt_iot_hub/models/iot_hub_sku_tier.rb'
61
+ autoload :JobType, 'generated/azure_mgmt_iot_hub/models/job_type.rb'
62
+ autoload :JobStatus, 'generated/azure_mgmt_iot_hub/models/job_status.rb'
63
+ autoload :IotHubScaleType, 'generated/azure_mgmt_iot_hub/models/iot_hub_scale_type.rb'
64
+ autoload :IotHubNameUnavailabilityReason, 'generated/azure_mgmt_iot_hub/models/iot_hub_name_unavailability_reason.rb'
65
+ end
66
+ end
@@ -0,0 +1,66 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::IotHub
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class IotHubClient < 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] The subscription identifier.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] Version of the Api.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] Gets or sets the preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
30
+ # Running Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
34
+ # is generated and included in each request. Default is true.
35
+ attr_accessor :generate_client_request_id
36
+
37
+ # @return Subscription credentials which uniquely identify client
38
+ # subscription.
39
+ attr_accessor :credentials
40
+
41
+ # @return [IotHubResource] iot_hub_resource
42
+ attr_reader :iot_hub_resource
43
+
44
+ #
45
+ # Creates initializes a new instance of the IotHubClient class.
46
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
47
+ # @param base_url [String] the base URI of the service.
48
+ # @param options [Array] filters to be applied to the HTTP requests.
49
+ #
50
+ def initialize(credentials, base_url = nil, options = nil)
51
+ super(credentials, options)
52
+ @base_url = base_url || 'https://management.azure.com'
53
+
54
+ fail ArgumentError, 'credentials is nil' if credentials.nil?
55
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
56
+ @credentials = credentials
57
+
58
+ @iot_hub_resource = IotHubResource.new(self)
59
+ @api_version = '2016-02-03'
60
+ @accept_language = 'en-US'
61
+ @long_running_operation_retry_timeout = 30
62
+ @generate_client_request_id = true
63
+ end
64
+
65
+ end
66
+ end
@@ -0,0 +1,2920 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::IotHub
7
+ #
8
+ # API for using the IoT Hub Features.
9
+ #
10
+ class IotHubResource
11
+ include Azure::ARM::IotHub::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the IotHubResource class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [IotHubClient] reference to the IotHubClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Get an IotHub.
27
+ #
28
+ # Get an IotHub.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group.
31
+ # @param resource_name [String] The name of the resource.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [IotHubDescription] operation results.
36
+ #
37
+ def get(resource_group_name, resource_name, custom_headers = nil)
38
+ response = get_async(resource_group_name, resource_name, custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Get an IotHub.
44
+ #
45
+ # Get an IotHub.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group.
48
+ # @param resource_name [String] The name of the resource.
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
53
+ #
54
+ def get_with_http_info(resource_group_name, resource_name, custom_headers = nil)
55
+ get_async(resource_group_name, resource_name, custom_headers).value!
56
+ end
57
+
58
+ #
59
+ # Get an IotHub.
60
+ #
61
+ # Get an IotHub.
62
+ #
63
+ # @param resource_group_name [String] The name of the resource group.
64
+ # @param resource_name [String] The name of the resource.
65
+ # @param [Hash{String => String}] A hash of custom headers that will be added
66
+ # to the HTTP request.
67
+ #
68
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
69
+ #
70
+ def get_async(resource_group_name, resource_name, custom_headers = nil)
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
75
+
76
+
77
+ request_headers = {}
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
83
+ options = {
84
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
85
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
86
+ query_params: {'api-version' => @client.api_version},
87
+ headers: request_headers.merge(custom_headers || {})
88
+ }
89
+
90
+ request_url = @base_url || @client.base_url
91
+
92
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
93
+ promise = request.run_promise do |req|
94
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
95
+ end
96
+
97
+ promise = promise.then do |http_response|
98
+ status_code = http_response.status
99
+ response_content = http_response.body
100
+ unless status_code == 200
101
+ error_model = JSON.load(response_content)
102
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
103
+ end
104
+
105
+ # Create Result
106
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = IotHubDescription.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Create or update an IotHub.
127
+ #
128
+ # Create or update an IotHub.
129
+ #
130
+ # @param resource_group_name [String] The name of the resource group.
131
+ # @param resource_name [String] The name of the resource.
132
+ # @param iot_hub_description [IotHubDescription] The Iot hub description.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [IotHubDescription] operation results.
137
+ #
138
+ def create_or_update(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
139
+ response = create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers).value!
140
+ response.body unless response.nil?
141
+ end
142
+
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group.
145
+ # @param resource_name [String] The name of the resource.
146
+ # @param iot_hub_description [IotHubDescription] The Iot hub description.
147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
148
+ # will be added to the HTTP request.
149
+ #
150
+ # @return [Concurrent::Promise] promise which provides async access to http
151
+ # response.
152
+ #
153
+ def create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
154
+ # Send request
155
+ promise = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers)
156
+
157
+ promise = promise.then do |response|
158
+ # Defining deserialization method.
159
+ deserialize_method = lambda do |parsed_response|
160
+ result_mapper = IotHubDescription.mapper()
161
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
162
+ end
163
+
164
+ # Waiting for response.
165
+ @client.get_long_running_operation_result(response, deserialize_method)
166
+ end
167
+
168
+ promise
169
+ end
170
+
171
+ #
172
+ # Create or update an IotHub.
173
+ #
174
+ # Create or update an IotHub.
175
+ #
176
+ # @param resource_group_name [String] The name of the resource group.
177
+ # @param resource_name [String] The name of the resource.
178
+ # @param iot_hub_description [IotHubDescription] The Iot hub description.
179
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
180
+ # will be added to the HTTP request.
181
+ #
182
+ # @return [IotHubDescription] operation results.
183
+ #
184
+ def begin_create_or_update(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
185
+ response = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers).value!
186
+ response.body unless response.nil?
187
+ end
188
+
189
+ #
190
+ # Create or update an IotHub.
191
+ #
192
+ # Create or update an IotHub.
193
+ #
194
+ # @param resource_group_name [String] The name of the resource group.
195
+ # @param resource_name [String] The name of the resource.
196
+ # @param iot_hub_description [IotHubDescription] The Iot hub description.
197
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
198
+ # will be added to the HTTP request.
199
+ #
200
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
201
+ #
202
+ def begin_create_or_update_with_http_info(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
203
+ begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers).value!
204
+ end
205
+
206
+ #
207
+ # Create or update an IotHub.
208
+ #
209
+ # Create or update an IotHub.
210
+ #
211
+ # @param resource_group_name [String] The name of the resource group.
212
+ # @param resource_name [String] The name of the resource.
213
+ # @param iot_hub_description [IotHubDescription] The Iot hub description.
214
+ # @param [Hash{String => String}] A hash of custom headers that will be added
215
+ # to the HTTP request.
216
+ #
217
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
218
+ #
219
+ def begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
220
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
221
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
222
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
223
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
224
+ fail ArgumentError, 'iot_hub_description is nil' if iot_hub_description.nil?
225
+
226
+
227
+ request_headers = {}
228
+
229
+ # Set Headers
230
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
231
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
232
+
233
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
234
+
235
+ # Serialize Request
236
+ request_mapper = IotHubDescription.mapper()
237
+ request_content = @client.serialize(request_mapper, iot_hub_description, 'iot_hub_description')
238
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
239
+
240
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
241
+ options = {
242
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
243
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
244
+ query_params: {'api-version' => @client.api_version},
245
+ body: request_content,
246
+ headers: request_headers.merge(custom_headers || {})
247
+ }
248
+
249
+ request_url = @base_url || @client.base_url
250
+
251
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
252
+ promise = request.run_promise do |req|
253
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
254
+ end
255
+
256
+ promise = promise.then do |http_response|
257
+ status_code = http_response.status
258
+ response_content = http_response.body
259
+ unless status_code == 201
260
+ error_model = JSON.load(response_content)
261
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
262
+ end
263
+
264
+ # Create Result
265
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
266
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
267
+ # Deserialize Response
268
+ if status_code == 201
269
+ begin
270
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
271
+ result_mapper = IotHubDescription.mapper()
272
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
273
+ rescue Exception => e
274
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
275
+ end
276
+ end
277
+
278
+ result
279
+ end
280
+
281
+ promise.execute
282
+ end
283
+
284
+ #
285
+ # Delete an IotHub.
286
+ #
287
+ # Delete an IotHub.
288
+ #
289
+ # @param resource_group_name [String] The name of the resource group.
290
+ # @param resource_name [String] The name of the resource.
291
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
292
+ # will be added to the HTTP request.
293
+ #
294
+ # @return [IotHubDescription] operation results.
295
+ #
296
+ def delete(resource_group_name, resource_name, custom_headers = nil)
297
+ response = delete_async(resource_group_name, resource_name, custom_headers).value!
298
+ response.body unless response.nil?
299
+ end
300
+
301
+ #
302
+ # @param resource_group_name [String] The name of the resource group.
303
+ # @param resource_name [String] The name of the resource.
304
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
305
+ # will be added to the HTTP request.
306
+ #
307
+ # @return [Concurrent::Promise] promise which provides async access to http
308
+ # response.
309
+ #
310
+ def delete_async(resource_group_name, resource_name, custom_headers = nil)
311
+ # Send request
312
+ promise = begin_delete_async(resource_group_name, resource_name, custom_headers)
313
+
314
+ promise = promise.then do |response|
315
+ # Defining deserialization method.
316
+ deserialize_method = lambda do |parsed_response|
317
+ result_mapper = IotHubDescription.mapper()
318
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
319
+ end
320
+
321
+ # Waiting for response.
322
+ @client.get_long_running_operation_result(response, deserialize_method)
323
+ end
324
+
325
+ promise
326
+ end
327
+
328
+ #
329
+ # Delete an IotHub.
330
+ #
331
+ # Delete an IotHub.
332
+ #
333
+ # @param resource_group_name [String] The name of the resource group.
334
+ # @param resource_name [String] The name of the resource.
335
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
336
+ # will be added to the HTTP request.
337
+ #
338
+ # @return [IotHubDescription] operation results.
339
+ #
340
+ def begin_delete(resource_group_name, resource_name, custom_headers = nil)
341
+ response = begin_delete_async(resource_group_name, resource_name, custom_headers).value!
342
+ response.body unless response.nil?
343
+ end
344
+
345
+ #
346
+ # Delete an IotHub.
347
+ #
348
+ # Delete an IotHub.
349
+ #
350
+ # @param resource_group_name [String] The name of the resource group.
351
+ # @param resource_name [String] The name of the resource.
352
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
353
+ # will be added to the HTTP request.
354
+ #
355
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
356
+ #
357
+ def begin_delete_with_http_info(resource_group_name, resource_name, custom_headers = nil)
358
+ begin_delete_async(resource_group_name, resource_name, custom_headers).value!
359
+ end
360
+
361
+ #
362
+ # Delete an IotHub.
363
+ #
364
+ # Delete an IotHub.
365
+ #
366
+ # @param resource_group_name [String] The name of the resource group.
367
+ # @param resource_name [String] The name of the resource.
368
+ # @param [Hash{String => String}] A hash of custom headers that will be added
369
+ # to the HTTP request.
370
+ #
371
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
372
+ #
373
+ def begin_delete_async(resource_group_name, resource_name, custom_headers = nil)
374
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
375
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
376
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
377
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
378
+
379
+
380
+ request_headers = {}
381
+
382
+ # Set Headers
383
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
384
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
385
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
386
+ options = {
387
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
388
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
389
+ query_params: {'api-version' => @client.api_version},
390
+ headers: request_headers.merge(custom_headers || {})
391
+ }
392
+
393
+ request_url = @base_url || @client.base_url
394
+
395
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
396
+ promise = request.run_promise do |req|
397
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
398
+ end
399
+
400
+ promise = promise.then do |http_response|
401
+ status_code = http_response.status
402
+ response_content = http_response.body
403
+ unless status_code == 202
404
+ error_model = JSON.load(response_content)
405
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
406
+ end
407
+
408
+ # Create Result
409
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
410
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
411
+ # Deserialize Response
412
+ if status_code == 202
413
+ begin
414
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
415
+ result_mapper = IotHubDescription.mapper()
416
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
417
+ rescue Exception => e
418
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
419
+ end
420
+ end
421
+
422
+ result
423
+ end
424
+
425
+ promise.execute
426
+ end
427
+
428
+ #
429
+ # Get all IotHubs in a subscription.
430
+ #
431
+ # Get all IotHubs in a subscription.
432
+ #
433
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
434
+ # will be added to the HTTP request.
435
+ #
436
+ # @return [IotHubDescriptionListResult] which provide lazy access to pages of
437
+ # the response.
438
+ #
439
+ def list_by_subscription_as_lazy(custom_headers = nil)
440
+ response = list_by_subscription_async(custom_headers).value!
441
+ unless response.nil?
442
+ page = response.body
443
+ page.next_method = Proc.new do |next_link|
444
+ list_by_subscription_next_async(next_link, custom_headers)
445
+ end
446
+ page
447
+ end
448
+ end
449
+
450
+ #
451
+ # Get all IotHubs in a subscription.
452
+ #
453
+ # Get all IotHubs in a subscription.
454
+ #
455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
456
+ # will be added to the HTTP request.
457
+ #
458
+ # @return [Array<IotHubDescription>] operation results.
459
+ #
460
+ def list_by_subscription(custom_headers = nil)
461
+ first_page = list_by_subscription_as_lazy(custom_headers)
462
+ first_page.get_all_items
463
+ end
464
+
465
+ #
466
+ # Get all IotHubs in a subscription.
467
+ #
468
+ # Get all IotHubs in a subscription.
469
+ #
470
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
471
+ # will be added to the HTTP request.
472
+ #
473
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
474
+ #
475
+ def list_by_subscription_with_http_info(custom_headers = nil)
476
+ list_by_subscription_async(custom_headers).value!
477
+ end
478
+
479
+ #
480
+ # Get all IotHubs in a subscription.
481
+ #
482
+ # Get all IotHubs in a subscription.
483
+ #
484
+ # @param [Hash{String => String}] A hash of custom headers that will be added
485
+ # to the HTTP request.
486
+ #
487
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
488
+ #
489
+ def list_by_subscription_async(custom_headers = nil)
490
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
491
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
492
+
493
+
494
+ request_headers = {}
495
+
496
+ # Set Headers
497
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
498
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
499
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'
500
+ options = {
501
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
502
+ path_params: {'subscriptionId' => @client.subscription_id},
503
+ query_params: {'api-version' => @client.api_version},
504
+ headers: request_headers.merge(custom_headers || {})
505
+ }
506
+
507
+ request_url = @base_url || @client.base_url
508
+
509
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
510
+ promise = request.run_promise do |req|
511
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
512
+ end
513
+
514
+ promise = promise.then do |http_response|
515
+ status_code = http_response.status
516
+ response_content = http_response.body
517
+ unless status_code == 200
518
+ error_model = JSON.load(response_content)
519
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
520
+ end
521
+
522
+ # Create Result
523
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
524
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
525
+ # Deserialize Response
526
+ if status_code == 200
527
+ begin
528
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
529
+ result_mapper = IotHubDescriptionListResult.mapper()
530
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
531
+ rescue Exception => e
532
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
533
+ end
534
+ end
535
+
536
+ result
537
+ end
538
+
539
+ promise.execute
540
+ end
541
+
542
+ #
543
+ # Get all IotHubs in a Resourcegroup.
544
+ #
545
+ # Get all IotHubs in a Resource group.
546
+ #
547
+ # @param resource_group_name [String] The name of the resource group.
548
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
549
+ # will be added to the HTTP request.
550
+ #
551
+ # @return [IotHubDescriptionListResult] which provide lazy access to pages of
552
+ # the response.
553
+ #
554
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
555
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
556
+ unless response.nil?
557
+ page = response.body
558
+ page.next_method = Proc.new do |next_link|
559
+ list_by_resource_group_next_async(next_link, custom_headers)
560
+ end
561
+ page
562
+ end
563
+ end
564
+
565
+ #
566
+ # Get all IotHubs in a Resourcegroup.
567
+ #
568
+ # Get all IotHubs in a Resource group.
569
+ #
570
+ # @param resource_group_name [String] The name of the resource group.
571
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
572
+ # will be added to the HTTP request.
573
+ #
574
+ # @return [Array<IotHubDescription>] operation results.
575
+ #
576
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
577
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
578
+ first_page.get_all_items
579
+ end
580
+
581
+ #
582
+ # Get all IotHubs in a Resourcegroup.
583
+ #
584
+ # Get all IotHubs in a Resource group.
585
+ #
586
+ # @param resource_group_name [String] The name of the resource group.
587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
588
+ # will be added to the HTTP request.
589
+ #
590
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
591
+ #
592
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
593
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
594
+ end
595
+
596
+ #
597
+ # Get all IotHubs in a Resourcegroup.
598
+ #
599
+ # Get all IotHubs in a Resource group.
600
+ #
601
+ # @param resource_group_name [String] The name of the resource group.
602
+ # @param [Hash{String => String}] A hash of custom headers that will be added
603
+ # to the HTTP request.
604
+ #
605
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
606
+ #
607
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
608
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
609
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
610
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
611
+
612
+
613
+ request_headers = {}
614
+
615
+ # Set Headers
616
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
617
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
618
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'
619
+ options = {
620
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
621
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
622
+ query_params: {'api-version' => @client.api_version},
623
+ headers: request_headers.merge(custom_headers || {})
624
+ }
625
+
626
+ request_url = @base_url || @client.base_url
627
+
628
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
629
+ promise = request.run_promise do |req|
630
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
631
+ end
632
+
633
+ promise = promise.then do |http_response|
634
+ status_code = http_response.status
635
+ response_content = http_response.body
636
+ unless status_code == 200
637
+ error_model = JSON.load(response_content)
638
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
639
+ end
640
+
641
+ # Create Result
642
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
643
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
644
+ # Deserialize Response
645
+ if status_code == 200
646
+ begin
647
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
648
+ result_mapper = IotHubDescriptionListResult.mapper()
649
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
650
+ rescue Exception => e
651
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
652
+ end
653
+ end
654
+
655
+ result
656
+ end
657
+
658
+ promise.execute
659
+ end
660
+
661
+ #
662
+ # Get IotHub Stats.
663
+ #
664
+ # Get IotHub Stats.
665
+ #
666
+ # @param resource_group_name [String] The name of the resource group.
667
+ # @param resource_name [String] The name of the resource.
668
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
669
+ # will be added to the HTTP request.
670
+ #
671
+ # @return [RegistryStatistics] operation results.
672
+ #
673
+ def get_stats(resource_group_name, resource_name, custom_headers = nil)
674
+ response = get_stats_async(resource_group_name, resource_name, custom_headers).value!
675
+ response.body unless response.nil?
676
+ end
677
+
678
+ #
679
+ # Get IotHub Stats.
680
+ #
681
+ # Get IotHub Stats.
682
+ #
683
+ # @param resource_group_name [String] The name of the resource group.
684
+ # @param resource_name [String] The name of the resource.
685
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
686
+ # will be added to the HTTP request.
687
+ #
688
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
689
+ #
690
+ def get_stats_with_http_info(resource_group_name, resource_name, custom_headers = nil)
691
+ get_stats_async(resource_group_name, resource_name, custom_headers).value!
692
+ end
693
+
694
+ #
695
+ # Get IotHub Stats.
696
+ #
697
+ # Get IotHub Stats.
698
+ #
699
+ # @param resource_group_name [String] The name of the resource group.
700
+ # @param resource_name [String] The name of the resource.
701
+ # @param [Hash{String => String}] A hash of custom headers that will be added
702
+ # to the HTTP request.
703
+ #
704
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
705
+ #
706
+ def get_stats_async(resource_group_name, resource_name, custom_headers = nil)
707
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
708
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
709
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
710
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
711
+
712
+
713
+ request_headers = {}
714
+
715
+ # Set Headers
716
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
717
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
718
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'
719
+ options = {
720
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
721
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
722
+ query_params: {'api-version' => @client.api_version},
723
+ headers: request_headers.merge(custom_headers || {})
724
+ }
725
+
726
+ request_url = @base_url || @client.base_url
727
+
728
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
729
+ promise = request.run_promise do |req|
730
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
731
+ end
732
+
733
+ promise = promise.then do |http_response|
734
+ status_code = http_response.status
735
+ response_content = http_response.body
736
+ unless status_code == 200
737
+ error_model = JSON.load(response_content)
738
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
739
+ end
740
+
741
+ # Create Result
742
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
743
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
744
+ # Deserialize Response
745
+ if status_code == 200
746
+ begin
747
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
748
+ result_mapper = RegistryStatistics.mapper()
749
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
750
+ rescue Exception => e
751
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
752
+ end
753
+ end
754
+
755
+ result
756
+ end
757
+
758
+ promise.execute
759
+ end
760
+
761
+ #
762
+ # Get Valid Skus.
763
+ #
764
+ # Get Valid Skus.
765
+ #
766
+ # @param resource_group_name [String] The name of the resource group.
767
+ # @param resource_name [String] The name of the resource.
768
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
769
+ # will be added to the HTTP request.
770
+ #
771
+ # @return [IotHubSkuDescriptionListResult] which provide lazy access to pages
772
+ # of the response.
773
+ #
774
+ def get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers = nil)
775
+ response = get_valid_skus_async(resource_group_name, resource_name, custom_headers).value!
776
+ unless response.nil?
777
+ page = response.body
778
+ page.next_method = Proc.new do |next_link|
779
+ get_valid_skus_next_async(next_link, custom_headers)
780
+ end
781
+ page
782
+ end
783
+ end
784
+
785
+ #
786
+ # Get Valid Skus.
787
+ #
788
+ # Get Valid Skus.
789
+ #
790
+ # @param resource_group_name [String] The name of the resource group.
791
+ # @param resource_name [String] The name of the resource.
792
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
793
+ # will be added to the HTTP request.
794
+ #
795
+ # @return [Array<IotHubSkuDescription>] operation results.
796
+ #
797
+ def get_valid_skus(resource_group_name, resource_name, custom_headers = nil)
798
+ first_page = get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers)
799
+ first_page.get_all_items
800
+ end
801
+
802
+ #
803
+ # Get Valid Skus.
804
+ #
805
+ # Get Valid Skus.
806
+ #
807
+ # @param resource_group_name [String] The name of the resource group.
808
+ # @param resource_name [String] The name of the resource.
809
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
810
+ # will be added to the HTTP request.
811
+ #
812
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
813
+ #
814
+ def get_valid_skus_with_http_info(resource_group_name, resource_name, custom_headers = nil)
815
+ get_valid_skus_async(resource_group_name, resource_name, custom_headers).value!
816
+ end
817
+
818
+ #
819
+ # Get Valid Skus.
820
+ #
821
+ # Get Valid Skus.
822
+ #
823
+ # @param resource_group_name [String] The name of the resource group.
824
+ # @param resource_name [String] The name of the resource.
825
+ # @param [Hash{String => String}] A hash of custom headers that will be added
826
+ # to the HTTP request.
827
+ #
828
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
829
+ #
830
+ def get_valid_skus_async(resource_group_name, resource_name, custom_headers = nil)
831
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
832
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
833
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
834
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
835
+
836
+
837
+ request_headers = {}
838
+
839
+ # Set Headers
840
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
841
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
842
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'
843
+ options = {
844
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
845
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
846
+ query_params: {'api-version' => @client.api_version},
847
+ headers: request_headers.merge(custom_headers || {})
848
+ }
849
+
850
+ request_url = @base_url || @client.base_url
851
+
852
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
853
+ promise = request.run_promise do |req|
854
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
855
+ end
856
+
857
+ promise = promise.then do |http_response|
858
+ status_code = http_response.status
859
+ response_content = http_response.body
860
+ unless status_code == 200
861
+ error_model = JSON.load(response_content)
862
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
863
+ end
864
+
865
+ # Create Result
866
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
867
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
868
+ # Deserialize Response
869
+ if status_code == 200
870
+ begin
871
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
872
+ result_mapper = IotHubSkuDescriptionListResult.mapper()
873
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
874
+ rescue Exception => e
875
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
876
+ end
877
+ end
878
+
879
+ result
880
+ end
881
+
882
+ promise.execute
883
+ end
884
+
885
+ #
886
+ # Get EventHub Consumer Groups for an IotHub.
887
+ #
888
+ # Get EventHub Consumer Groups for an IotHub.
889
+ #
890
+ # @param resource_group_name [String] The name of the resource group.
891
+ # @param resource_name [String] The name of the resource.
892
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
893
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
894
+ # will be added to the HTTP request.
895
+ #
896
+ # @return [EventHubConsumerGroupsListResult] which provide lazy access to
897
+ # pages of the response.
898
+ #
899
+ def list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil)
900
+ response = list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers).value!
901
+ unless response.nil?
902
+ page = response.body
903
+ page.next_method = Proc.new do |next_link|
904
+ list_event_hub_consumer_groups_next_async(next_link, custom_headers)
905
+ end
906
+ page
907
+ end
908
+ end
909
+
910
+ #
911
+ # Get EventHub Consumer Groups for an IotHub.
912
+ #
913
+ # Get EventHub Consumer Groups for an IotHub.
914
+ #
915
+ # @param resource_group_name [String] The name of the resource group.
916
+ # @param resource_name [String] The name of the resource.
917
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
918
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
919
+ # will be added to the HTTP request.
920
+ #
921
+ # @return [Array<String>] operation results.
922
+ #
923
+ def list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil)
924
+ first_page = list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers)
925
+ first_page.get_all_items
926
+ end
927
+
928
+ #
929
+ # Get EventHub Consumer Groups for an IotHub.
930
+ #
931
+ # Get EventHub Consumer Groups for an IotHub.
932
+ #
933
+ # @param resource_group_name [String] The name of the resource group.
934
+ # @param resource_name [String] The name of the resource.
935
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
936
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
937
+ # will be added to the HTTP request.
938
+ #
939
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
940
+ #
941
+ def list_event_hub_consumer_groups_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil)
942
+ list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers).value!
943
+ end
944
+
945
+ #
946
+ # Get EventHub Consumer Groups for an IotHub.
947
+ #
948
+ # Get EventHub Consumer Groups for an IotHub.
949
+ #
950
+ # @param resource_group_name [String] The name of the resource group.
951
+ # @param resource_name [String] The name of the resource.
952
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
953
+ # @param [Hash{String => String}] A hash of custom headers that will be added
954
+ # to the HTTP request.
955
+ #
956
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
957
+ #
958
+ def list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil)
959
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
960
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
961
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
962
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
963
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
964
+
965
+
966
+ request_headers = {}
967
+
968
+ # Set Headers
969
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
970
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
971
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'
972
+ options = {
973
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
974
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name},
975
+ query_params: {'api-version' => @client.api_version},
976
+ headers: request_headers.merge(custom_headers || {})
977
+ }
978
+
979
+ request_url = @base_url || @client.base_url
980
+
981
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
982
+ promise = request.run_promise do |req|
983
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
984
+ end
985
+
986
+ promise = promise.then do |http_response|
987
+ status_code = http_response.status
988
+ response_content = http_response.body
989
+ unless status_code == 200
990
+ error_model = JSON.load(response_content)
991
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
992
+ end
993
+
994
+ # Create Result
995
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
996
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
997
+ # Deserialize Response
998
+ if status_code == 200
999
+ begin
1000
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1001
+ result_mapper = EventHubConsumerGroupsListResult.mapper()
1002
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1003
+ rescue Exception => e
1004
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1005
+ end
1006
+ end
1007
+
1008
+ result
1009
+ end
1010
+
1011
+ promise.execute
1012
+ end
1013
+
1014
+ #
1015
+ # Get EventHub Consumer Group for an IotHub.
1016
+ #
1017
+ # Get EventHub Consumer Group for an IotHub.
1018
+ #
1019
+ # @param resource_group_name [String] The name of the resource group.
1020
+ # @param resource_name [String] The name of the resource.
1021
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
1022
+ # @param name [String] The name of the consumer group.
1023
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1024
+ # will be added to the HTTP request.
1025
+ #
1026
+ # @return [EventHubConsumerGroupInfo] operation results.
1027
+ #
1028
+ def get_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
1029
+ response = get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
1030
+ response.body unless response.nil?
1031
+ end
1032
+
1033
+ #
1034
+ # Get EventHub Consumer Group for an IotHub.
1035
+ #
1036
+ # Get EventHub Consumer Group for an IotHub.
1037
+ #
1038
+ # @param resource_group_name [String] The name of the resource group.
1039
+ # @param resource_name [String] The name of the resource.
1040
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
1041
+ # @param name [String] The name of the consumer group.
1042
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1043
+ # will be added to the HTTP request.
1044
+ #
1045
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1046
+ #
1047
+ def get_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
1048
+ get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
1049
+ end
1050
+
1051
+ #
1052
+ # Get EventHub Consumer Group for an IotHub.
1053
+ #
1054
+ # Get EventHub Consumer Group for an IotHub.
1055
+ #
1056
+ # @param resource_group_name [String] The name of the resource group.
1057
+ # @param resource_name [String] The name of the resource.
1058
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
1059
+ # @param name [String] The name of the consumer group.
1060
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1061
+ # to the HTTP request.
1062
+ #
1063
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1064
+ #
1065
+ def get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
1066
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1067
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1068
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1069
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1070
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
1071
+ fail ArgumentError, 'name is nil' if name.nil?
1072
+
1073
+
1074
+ request_headers = {}
1075
+
1076
+ # Set Headers
1077
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1078
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1079
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
1080
+ options = {
1081
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1082
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
1083
+ query_params: {'api-version' => @client.api_version},
1084
+ headers: request_headers.merge(custom_headers || {})
1085
+ }
1086
+
1087
+ request_url = @base_url || @client.base_url
1088
+
1089
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1090
+ promise = request.run_promise do |req|
1091
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1092
+ end
1093
+
1094
+ promise = promise.then do |http_response|
1095
+ status_code = http_response.status
1096
+ response_content = http_response.body
1097
+ unless status_code == 200
1098
+ error_model = JSON.load(response_content)
1099
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1100
+ end
1101
+
1102
+ # Create Result
1103
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1105
+ # Deserialize Response
1106
+ if status_code == 200
1107
+ begin
1108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1109
+ result_mapper = EventHubConsumerGroupInfo.mapper()
1110
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1111
+ rescue Exception => e
1112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1113
+ end
1114
+ end
1115
+
1116
+ result
1117
+ end
1118
+
1119
+ promise.execute
1120
+ end
1121
+
1122
+ #
1123
+ # Add an EventHub Consumer Group to an IotHub.
1124
+ #
1125
+ # Add an EventHub Consumer Group to an IotHub.
1126
+ #
1127
+ # @param resource_group_name [String] The name of the resource group.
1128
+ # @param resource_name [String] The name of the resource.
1129
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
1130
+ # @param name [String] The name of the consumer group.
1131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1132
+ # will be added to the HTTP request.
1133
+ #
1134
+ # @return [EventHubConsumerGroupInfo] operation results.
1135
+ #
1136
+ def create_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
1137
+ response = create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
1138
+ response.body unless response.nil?
1139
+ end
1140
+
1141
+ #
1142
+ # Add an EventHub Consumer Group to an IotHub.
1143
+ #
1144
+ # Add an EventHub Consumer Group to an IotHub.
1145
+ #
1146
+ # @param resource_group_name [String] The name of the resource group.
1147
+ # @param resource_name [String] The name of the resource.
1148
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
1149
+ # @param name [String] The name of the consumer group.
1150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1151
+ # will be added to the HTTP request.
1152
+ #
1153
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1154
+ #
1155
+ def create_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
1156
+ create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
1157
+ end
1158
+
1159
+ #
1160
+ # Add an EventHub Consumer Group to an IotHub.
1161
+ #
1162
+ # Add an EventHub Consumer Group to an IotHub.
1163
+ #
1164
+ # @param resource_group_name [String] The name of the resource group.
1165
+ # @param resource_name [String] The name of the resource.
1166
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
1167
+ # @param name [String] The name of the consumer group.
1168
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1169
+ # to the HTTP request.
1170
+ #
1171
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1172
+ #
1173
+ def create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
1174
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1175
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1176
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1177
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1178
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
1179
+ fail ArgumentError, 'name is nil' if name.nil?
1180
+
1181
+
1182
+ request_headers = {}
1183
+
1184
+ # Set Headers
1185
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1186
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1187
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
1188
+ options = {
1189
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1190
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
1191
+ query_params: {'api-version' => @client.api_version},
1192
+ headers: request_headers.merge(custom_headers || {})
1193
+ }
1194
+
1195
+ request_url = @base_url || @client.base_url
1196
+
1197
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
1198
+ promise = request.run_promise do |req|
1199
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1200
+ end
1201
+
1202
+ promise = promise.then do |http_response|
1203
+ status_code = http_response.status
1204
+ response_content = http_response.body
1205
+ unless status_code == 200
1206
+ error_model = JSON.load(response_content)
1207
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1208
+ end
1209
+
1210
+ # Create Result
1211
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1212
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1213
+ # Deserialize Response
1214
+ if status_code == 200
1215
+ begin
1216
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1217
+ result_mapper = EventHubConsumerGroupInfo.mapper()
1218
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1219
+ rescue Exception => e
1220
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1221
+ end
1222
+ end
1223
+
1224
+ result
1225
+ end
1226
+
1227
+ promise.execute
1228
+ end
1229
+
1230
+ #
1231
+ # Delete EventHub Consumer Group for an IotHub.
1232
+ #
1233
+ # Delete EventHub Consumer Group for an IotHub.
1234
+ #
1235
+ # @param resource_group_name [String] The name of the resource group.
1236
+ # @param resource_name [String] The name of the resource.
1237
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
1238
+ # @param name [String] The name of the consumer group.
1239
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1240
+ # will be added to the HTTP request.
1241
+ #
1242
+ #
1243
+ def delete_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
1244
+ response = delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
1245
+ nil
1246
+ end
1247
+
1248
+ #
1249
+ # Delete EventHub Consumer Group for an IotHub.
1250
+ #
1251
+ # Delete EventHub Consumer Group for an IotHub.
1252
+ #
1253
+ # @param resource_group_name [String] The name of the resource group.
1254
+ # @param resource_name [String] The name of the resource.
1255
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
1256
+ # @param name [String] The name of the consumer group.
1257
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1258
+ # will be added to the HTTP request.
1259
+ #
1260
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1261
+ #
1262
+ def delete_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
1263
+ delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
1264
+ end
1265
+
1266
+ #
1267
+ # Delete EventHub Consumer Group for an IotHub.
1268
+ #
1269
+ # Delete EventHub Consumer Group for an IotHub.
1270
+ #
1271
+ # @param resource_group_name [String] The name of the resource group.
1272
+ # @param resource_name [String] The name of the resource.
1273
+ # @param event_hub_endpoint_name [String] The name of the event hub endpoint.
1274
+ # @param name [String] The name of the consumer group.
1275
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1276
+ # to the HTTP request.
1277
+ #
1278
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1279
+ #
1280
+ def delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
1281
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1282
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1283
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1284
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1285
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
1286
+ fail ArgumentError, 'name is nil' if name.nil?
1287
+
1288
+
1289
+ request_headers = {}
1290
+
1291
+ # Set Headers
1292
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1293
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1294
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
1295
+ options = {
1296
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1297
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
1298
+ query_params: {'api-version' => @client.api_version},
1299
+ headers: request_headers.merge(custom_headers || {})
1300
+ }
1301
+
1302
+ request_url = @base_url || @client.base_url
1303
+
1304
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
1305
+ promise = request.run_promise do |req|
1306
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1307
+ end
1308
+
1309
+ promise = promise.then do |http_response|
1310
+ status_code = http_response.status
1311
+ response_content = http_response.body
1312
+ unless status_code == 200
1313
+ error_model = JSON.load(response_content)
1314
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1315
+ end
1316
+
1317
+ # Create Result
1318
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1319
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1320
+
1321
+ result
1322
+ end
1323
+
1324
+ promise.execute
1325
+ end
1326
+
1327
+ #
1328
+ # Get all the jobs in an IotHub.
1329
+ #
1330
+ # Get all the jobs in an IotHub.
1331
+ #
1332
+ # @param resource_group_name [String] The name of the resource group.
1333
+ # @param resource_name [String] The name of the resource.
1334
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1335
+ # will be added to the HTTP request.
1336
+ #
1337
+ # @return [JobResponseListResult] which provide lazy access to pages of the
1338
+ # response.
1339
+ #
1340
+ def list_jobs_as_lazy(resource_group_name, resource_name, custom_headers = nil)
1341
+ response = list_jobs_async(resource_group_name, resource_name, custom_headers).value!
1342
+ unless response.nil?
1343
+ page = response.body
1344
+ page.next_method = Proc.new do |next_link|
1345
+ list_jobs_next_async(next_link, custom_headers)
1346
+ end
1347
+ page
1348
+ end
1349
+ end
1350
+
1351
+ #
1352
+ # Get all the jobs in an IotHub.
1353
+ #
1354
+ # Get all the jobs in an IotHub.
1355
+ #
1356
+ # @param resource_group_name [String] The name of the resource group.
1357
+ # @param resource_name [String] The name of the resource.
1358
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1359
+ # will be added to the HTTP request.
1360
+ #
1361
+ # @return [Array<JobResponse>] operation results.
1362
+ #
1363
+ def list_jobs(resource_group_name, resource_name, custom_headers = nil)
1364
+ first_page = list_jobs_as_lazy(resource_group_name, resource_name, custom_headers)
1365
+ first_page.get_all_items
1366
+ end
1367
+
1368
+ #
1369
+ # Get all the jobs in an IotHub.
1370
+ #
1371
+ # Get all the jobs in an IotHub.
1372
+ #
1373
+ # @param resource_group_name [String] The name of the resource group.
1374
+ # @param resource_name [String] The name of the resource.
1375
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1376
+ # will be added to the HTTP request.
1377
+ #
1378
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1379
+ #
1380
+ def list_jobs_with_http_info(resource_group_name, resource_name, custom_headers = nil)
1381
+ list_jobs_async(resource_group_name, resource_name, custom_headers).value!
1382
+ end
1383
+
1384
+ #
1385
+ # Get all the jobs in an IotHub.
1386
+ #
1387
+ # Get all the jobs in an IotHub.
1388
+ #
1389
+ # @param resource_group_name [String] The name of the resource group.
1390
+ # @param resource_name [String] The name of the resource.
1391
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1392
+ # to the HTTP request.
1393
+ #
1394
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1395
+ #
1396
+ def list_jobs_async(resource_group_name, resource_name, custom_headers = nil)
1397
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1398
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1399
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1400
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1401
+
1402
+
1403
+ request_headers = {}
1404
+
1405
+ # Set Headers
1406
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1407
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1408
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'
1409
+ options = {
1410
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1411
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1412
+ query_params: {'api-version' => @client.api_version},
1413
+ headers: request_headers.merge(custom_headers || {})
1414
+ }
1415
+
1416
+ request_url = @base_url || @client.base_url
1417
+
1418
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1419
+ promise = request.run_promise do |req|
1420
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1421
+ end
1422
+
1423
+ promise = promise.then do |http_response|
1424
+ status_code = http_response.status
1425
+ response_content = http_response.body
1426
+ unless status_code == 200
1427
+ error_model = JSON.load(response_content)
1428
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1429
+ end
1430
+
1431
+ # Create Result
1432
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1433
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1434
+ # Deserialize Response
1435
+ if status_code == 200
1436
+ begin
1437
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1438
+ result_mapper = JobResponseListResult.mapper()
1439
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1440
+ rescue Exception => e
1441
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1442
+ end
1443
+ end
1444
+
1445
+ result
1446
+ end
1447
+
1448
+ promise.execute
1449
+ end
1450
+
1451
+ #
1452
+ # Get a job in an IotHub.
1453
+ #
1454
+ # Get a job in an IotHub.
1455
+ #
1456
+ # @param resource_group_name [String] The name of the resource group.
1457
+ # @param resource_name [String] The name of the resource.
1458
+ # @param job_id [String] The job identifier.
1459
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1460
+ # will be added to the HTTP request.
1461
+ #
1462
+ # @return [JobResponse] operation results.
1463
+ #
1464
+ def get_job(resource_group_name, resource_name, job_id, custom_headers = nil)
1465
+ response = get_job_async(resource_group_name, resource_name, job_id, custom_headers).value!
1466
+ response.body unless response.nil?
1467
+ end
1468
+
1469
+ #
1470
+ # Get a job in an IotHub.
1471
+ #
1472
+ # Get a job in an IotHub.
1473
+ #
1474
+ # @param resource_group_name [String] The name of the resource group.
1475
+ # @param resource_name [String] The name of the resource.
1476
+ # @param job_id [String] The job identifier.
1477
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1478
+ # will be added to the HTTP request.
1479
+ #
1480
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1481
+ #
1482
+ def get_job_with_http_info(resource_group_name, resource_name, job_id, custom_headers = nil)
1483
+ get_job_async(resource_group_name, resource_name, job_id, custom_headers).value!
1484
+ end
1485
+
1486
+ #
1487
+ # Get a job in an IotHub.
1488
+ #
1489
+ # Get a job in an IotHub.
1490
+ #
1491
+ # @param resource_group_name [String] The name of the resource group.
1492
+ # @param resource_name [String] The name of the resource.
1493
+ # @param job_id [String] The job identifier.
1494
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1495
+ # to the HTTP request.
1496
+ #
1497
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1498
+ #
1499
+ def get_job_async(resource_group_name, resource_name, job_id, custom_headers = nil)
1500
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1501
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1502
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1503
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1504
+ fail ArgumentError, 'job_id is nil' if job_id.nil?
1505
+
1506
+
1507
+ request_headers = {}
1508
+
1509
+ # Set Headers
1510
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1511
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1512
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'
1513
+ options = {
1514
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1515
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'jobId' => job_id},
1516
+ query_params: {'api-version' => @client.api_version},
1517
+ headers: request_headers.merge(custom_headers || {})
1518
+ }
1519
+
1520
+ request_url = @base_url || @client.base_url
1521
+
1522
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1523
+ promise = request.run_promise do |req|
1524
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1525
+ end
1526
+
1527
+ promise = promise.then do |http_response|
1528
+ status_code = http_response.status
1529
+ response_content = http_response.body
1530
+ unless status_code == 200
1531
+ error_model = JSON.load(response_content)
1532
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1533
+ end
1534
+
1535
+ # Create Result
1536
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1537
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1538
+ # Deserialize Response
1539
+ if status_code == 200
1540
+ begin
1541
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1542
+ result_mapper = JobResponse.mapper()
1543
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1544
+ rescue Exception => e
1545
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1546
+ end
1547
+ end
1548
+
1549
+ result
1550
+ end
1551
+
1552
+ promise.execute
1553
+ end
1554
+
1555
+ #
1556
+ # Get quota metrics for an IotHub.
1557
+ #
1558
+ # Get quota metrics for an IotHub.
1559
+ #
1560
+ # @param resource_group_name [String] The name of the resource group.
1561
+ # @param resource_name [String] The name of the resource.
1562
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1563
+ # will be added to the HTTP request.
1564
+ #
1565
+ # @return [IotHubQuotaMetricInfoListResult] which provide lazy access to pages
1566
+ # of the response.
1567
+ #
1568
+ def get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers = nil)
1569
+ response = get_quota_metrics_async(resource_group_name, resource_name, custom_headers).value!
1570
+ unless response.nil?
1571
+ page = response.body
1572
+ page.next_method = Proc.new do |next_link|
1573
+ get_quota_metrics_next_async(next_link, custom_headers)
1574
+ end
1575
+ page
1576
+ end
1577
+ end
1578
+
1579
+ #
1580
+ # Get quota metrics for an IotHub.
1581
+ #
1582
+ # Get quota metrics for an IotHub.
1583
+ #
1584
+ # @param resource_group_name [String] The name of the resource group.
1585
+ # @param resource_name [String] The name of the resource.
1586
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1587
+ # will be added to the HTTP request.
1588
+ #
1589
+ # @return [Array<IotHubQuotaMetricInfo>] operation results.
1590
+ #
1591
+ def get_quota_metrics(resource_group_name, resource_name, custom_headers = nil)
1592
+ first_page = get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers)
1593
+ first_page.get_all_items
1594
+ end
1595
+
1596
+ #
1597
+ # Get quota metrics for an IotHub.
1598
+ #
1599
+ # Get quota metrics for an IotHub.
1600
+ #
1601
+ # @param resource_group_name [String] The name of the resource group.
1602
+ # @param resource_name [String] The name of the resource.
1603
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1604
+ # will be added to the HTTP request.
1605
+ #
1606
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1607
+ #
1608
+ def get_quota_metrics_with_http_info(resource_group_name, resource_name, custom_headers = nil)
1609
+ get_quota_metrics_async(resource_group_name, resource_name, custom_headers).value!
1610
+ end
1611
+
1612
+ #
1613
+ # Get quota metrics for an IotHub.
1614
+ #
1615
+ # Get quota metrics for an IotHub.
1616
+ #
1617
+ # @param resource_group_name [String] The name of the resource group.
1618
+ # @param resource_name [String] The name of the resource.
1619
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1620
+ # to the HTTP request.
1621
+ #
1622
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1623
+ #
1624
+ def get_quota_metrics_async(resource_group_name, resource_name, custom_headers = nil)
1625
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1626
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1627
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1628
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1629
+
1630
+
1631
+ request_headers = {}
1632
+
1633
+ # Set Headers
1634
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1635
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1636
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'
1637
+ options = {
1638
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1639
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1640
+ query_params: {'api-version' => @client.api_version},
1641
+ headers: request_headers.merge(custom_headers || {})
1642
+ }
1643
+
1644
+ request_url = @base_url || @client.base_url
1645
+
1646
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1647
+ promise = request.run_promise do |req|
1648
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1649
+ end
1650
+
1651
+ promise = promise.then do |http_response|
1652
+ status_code = http_response.status
1653
+ response_content = http_response.body
1654
+ unless status_code == 200
1655
+ error_model = JSON.load(response_content)
1656
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1657
+ end
1658
+
1659
+ # Create Result
1660
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1661
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1662
+ # Deserialize Response
1663
+ if status_code == 200
1664
+ begin
1665
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1666
+ result_mapper = IotHubQuotaMetricInfoListResult.mapper()
1667
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1668
+ rescue Exception => e
1669
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1670
+ end
1671
+ end
1672
+
1673
+ result
1674
+ end
1675
+
1676
+ promise.execute
1677
+ end
1678
+
1679
+ #
1680
+ # Check if an IotHub name is available.
1681
+ #
1682
+ # Check if an IotHub name is available.
1683
+ #
1684
+ # @param operation_inputs [OperationInputs] The operation inputs. Set the name
1685
+ # parameter in the operationInputs structure to the desired iothub name.
1686
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1687
+ # will be added to the HTTP request.
1688
+ #
1689
+ # @return [IotHubNameAvailabilityInfo] operation results.
1690
+ #
1691
+ def check_name_availability(operation_inputs, custom_headers = nil)
1692
+ response = check_name_availability_async(operation_inputs, custom_headers).value!
1693
+ response.body unless response.nil?
1694
+ end
1695
+
1696
+ #
1697
+ # Check if an IotHub name is available.
1698
+ #
1699
+ # Check if an IotHub name is available.
1700
+ #
1701
+ # @param operation_inputs [OperationInputs] The operation inputs. Set the name
1702
+ # parameter in the operationInputs structure to the desired iothub name.
1703
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1704
+ # will be added to the HTTP request.
1705
+ #
1706
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1707
+ #
1708
+ def check_name_availability_with_http_info(operation_inputs, custom_headers = nil)
1709
+ check_name_availability_async(operation_inputs, custom_headers).value!
1710
+ end
1711
+
1712
+ #
1713
+ # Check if an IotHub name is available.
1714
+ #
1715
+ # Check if an IotHub name is available.
1716
+ #
1717
+ # @param operation_inputs [OperationInputs] The operation inputs. Set the name
1718
+ # parameter in the operationInputs structure to the desired iothub name.
1719
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1720
+ # to the HTTP request.
1721
+ #
1722
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1723
+ #
1724
+ def check_name_availability_async(operation_inputs, custom_headers = nil)
1725
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1726
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1727
+ fail ArgumentError, 'operation_inputs is nil' if operation_inputs.nil?
1728
+
1729
+
1730
+ request_headers = {}
1731
+
1732
+ # Set Headers
1733
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1734
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1735
+
1736
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1737
+
1738
+ # Serialize Request
1739
+ request_mapper = OperationInputs.mapper()
1740
+ request_content = @client.serialize(request_mapper, operation_inputs, 'operation_inputs')
1741
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1742
+
1743
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'
1744
+ options = {
1745
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1746
+ path_params: {'subscriptionId' => @client.subscription_id},
1747
+ query_params: {'api-version' => @client.api_version},
1748
+ body: request_content,
1749
+ headers: request_headers.merge(custom_headers || {})
1750
+ }
1751
+
1752
+ request_url = @base_url || @client.base_url
1753
+
1754
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
1755
+ promise = request.run_promise do |req|
1756
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1757
+ end
1758
+
1759
+ promise = promise.then do |http_response|
1760
+ status_code = http_response.status
1761
+ response_content = http_response.body
1762
+ unless status_code == 200
1763
+ error_model = JSON.load(response_content)
1764
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1765
+ end
1766
+
1767
+ # Create Result
1768
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1769
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1770
+ # Deserialize Response
1771
+ if status_code == 200
1772
+ begin
1773
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1774
+ result_mapper = IotHubNameAvailabilityInfo.mapper()
1775
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1776
+ rescue Exception => e
1777
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1778
+ end
1779
+ end
1780
+
1781
+ result
1782
+ end
1783
+
1784
+ promise.execute
1785
+ end
1786
+
1787
+ #
1788
+ # Get all keys for an IotHub.
1789
+ #
1790
+ # Get all keys for an IotHub.
1791
+ #
1792
+ # @param resource_group_name [String] The name of the resource group.
1793
+ # @param resource_name [String] The name of the resource.
1794
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1795
+ # will be added to the HTTP request.
1796
+ #
1797
+ # @return [SharedAccessSignatureAuthorizationRuleListResult] which provide
1798
+ # lazy access to pages of the response.
1799
+ #
1800
+ def list_keys_as_lazy(resource_group_name, resource_name, custom_headers = nil)
1801
+ response = list_keys_async(resource_group_name, resource_name, custom_headers).value!
1802
+ unless response.nil?
1803
+ page = response.body
1804
+ page.next_method = Proc.new do |next_link|
1805
+ list_keys_next_async(next_link, custom_headers)
1806
+ end
1807
+ page
1808
+ end
1809
+ end
1810
+
1811
+ #
1812
+ # Get all keys for an IotHub.
1813
+ #
1814
+ # Get all keys for an IotHub.
1815
+ #
1816
+ # @param resource_group_name [String] The name of the resource group.
1817
+ # @param resource_name [String] The name of the resource.
1818
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1819
+ # will be added to the HTTP request.
1820
+ #
1821
+ # @return [Array<SharedAccessSignatureAuthorizationRule>] operation results.
1822
+ #
1823
+ def list_keys(resource_group_name, resource_name, custom_headers = nil)
1824
+ first_page = list_keys_as_lazy(resource_group_name, resource_name, custom_headers)
1825
+ first_page.get_all_items
1826
+ end
1827
+
1828
+ #
1829
+ # Get all keys for an IotHub.
1830
+ #
1831
+ # Get all keys for an IotHub.
1832
+ #
1833
+ # @param resource_group_name [String] The name of the resource group.
1834
+ # @param resource_name [String] The name of the resource.
1835
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1836
+ # will be added to the HTTP request.
1837
+ #
1838
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1839
+ #
1840
+ def list_keys_with_http_info(resource_group_name, resource_name, custom_headers = nil)
1841
+ list_keys_async(resource_group_name, resource_name, custom_headers).value!
1842
+ end
1843
+
1844
+ #
1845
+ # Get all keys for an IotHub.
1846
+ #
1847
+ # Get all keys for an IotHub.
1848
+ #
1849
+ # @param resource_group_name [String] The name of the resource group.
1850
+ # @param resource_name [String] The name of the resource.
1851
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1852
+ # to the HTTP request.
1853
+ #
1854
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1855
+ #
1856
+ def list_keys_async(resource_group_name, resource_name, custom_headers = nil)
1857
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1858
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1859
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1860
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1861
+
1862
+
1863
+ request_headers = {}
1864
+
1865
+ # Set Headers
1866
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1867
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1868
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'
1869
+ options = {
1870
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1871
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1872
+ query_params: {'api-version' => @client.api_version},
1873
+ headers: request_headers.merge(custom_headers || {})
1874
+ }
1875
+
1876
+ request_url = @base_url || @client.base_url
1877
+
1878
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
1879
+ promise = request.run_promise do |req|
1880
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1881
+ end
1882
+
1883
+ promise = promise.then do |http_response|
1884
+ status_code = http_response.status
1885
+ response_content = http_response.body
1886
+ unless status_code == 200
1887
+ error_model = JSON.load(response_content)
1888
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1889
+ end
1890
+
1891
+ # Create Result
1892
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1893
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1894
+ # Deserialize Response
1895
+ if status_code == 200
1896
+ begin
1897
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1898
+ result_mapper = SharedAccessSignatureAuthorizationRuleListResult.mapper()
1899
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1900
+ rescue Exception => e
1901
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1902
+ end
1903
+ end
1904
+
1905
+ result
1906
+ end
1907
+
1908
+ promise.execute
1909
+ end
1910
+
1911
+ #
1912
+ # Get the Key given a specific KeyName for an IotHub.
1913
+ #
1914
+ # Get the Key given a specific KeyName for an IotHub.
1915
+ #
1916
+ # @param resource_group_name [String] The name of the resource group.
1917
+ # @param resource_name [String] The name of the resource.
1918
+ # @param key_name [String] The name of the key.
1919
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1920
+ # will be added to the HTTP request.
1921
+ #
1922
+ # @return [SharedAccessSignatureAuthorizationRule] operation results.
1923
+ #
1924
+ def get_keys_for_key_name(resource_group_name, resource_name, key_name, custom_headers = nil)
1925
+ response = get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers).value!
1926
+ response.body unless response.nil?
1927
+ end
1928
+
1929
+ #
1930
+ # Get the Key given a specific KeyName for an IotHub.
1931
+ #
1932
+ # Get the Key given a specific KeyName for an IotHub.
1933
+ #
1934
+ # @param resource_group_name [String] The name of the resource group.
1935
+ # @param resource_name [String] The name of the resource.
1936
+ # @param key_name [String] The name of the key.
1937
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1938
+ # will be added to the HTTP request.
1939
+ #
1940
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1941
+ #
1942
+ def get_keys_for_key_name_with_http_info(resource_group_name, resource_name, key_name, custom_headers = nil)
1943
+ get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers).value!
1944
+ end
1945
+
1946
+ #
1947
+ # Get the Key given a specific KeyName for an IotHub.
1948
+ #
1949
+ # Get the Key given a specific KeyName for an IotHub.
1950
+ #
1951
+ # @param resource_group_name [String] The name of the resource group.
1952
+ # @param resource_name [String] The name of the resource.
1953
+ # @param key_name [String] The name of the key.
1954
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1955
+ # to the HTTP request.
1956
+ #
1957
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1958
+ #
1959
+ def get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers = nil)
1960
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1961
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1962
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1963
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1964
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
1965
+
1966
+
1967
+ request_headers = {}
1968
+
1969
+ # Set Headers
1970
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1971
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1972
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'
1973
+ options = {
1974
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1975
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'keyName' => key_name},
1976
+ query_params: {'api-version' => @client.api_version},
1977
+ headers: request_headers.merge(custom_headers || {})
1978
+ }
1979
+
1980
+ request_url = @base_url || @client.base_url
1981
+
1982
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
1983
+ promise = request.run_promise do |req|
1984
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1985
+ end
1986
+
1987
+ promise = promise.then do |http_response|
1988
+ status_code = http_response.status
1989
+ response_content = http_response.body
1990
+ unless status_code == 200
1991
+ error_model = JSON.load(response_content)
1992
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1993
+ end
1994
+
1995
+ # Create Result
1996
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1997
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1998
+ # Deserialize Response
1999
+ if status_code == 200
2000
+ begin
2001
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2002
+ result_mapper = SharedAccessSignatureAuthorizationRule.mapper()
2003
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2004
+ rescue Exception => e
2005
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2006
+ end
2007
+ end
2008
+
2009
+ result
2010
+ end
2011
+
2012
+ promise.execute
2013
+ end
2014
+
2015
+ #
2016
+ # Export all the devices in an IotHub.
2017
+ #
2018
+ # Export all the devices in an IotHub.
2019
+ #
2020
+ # @param resource_group_name [String] The name of the resource group.
2021
+ # @param resource_name [String] The name of the resource.
2022
+ # @param export_devices_parameters [ExportDevicesRequest] The export devices
2023
+ # parameters.
2024
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2025
+ # will be added to the HTTP request.
2026
+ #
2027
+ # @return [JobResponse] operation results.
2028
+ #
2029
+ def export_devices(resource_group_name, resource_name, export_devices_parameters, custom_headers = nil)
2030
+ response = export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers).value!
2031
+ response.body unless response.nil?
2032
+ end
2033
+
2034
+ #
2035
+ # Export all the devices in an IotHub.
2036
+ #
2037
+ # Export all the devices in an IotHub.
2038
+ #
2039
+ # @param resource_group_name [String] The name of the resource group.
2040
+ # @param resource_name [String] The name of the resource.
2041
+ # @param export_devices_parameters [ExportDevicesRequest] The export devices
2042
+ # parameters.
2043
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2044
+ # will be added to the HTTP request.
2045
+ #
2046
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2047
+ #
2048
+ def export_devices_with_http_info(resource_group_name, resource_name, export_devices_parameters, custom_headers = nil)
2049
+ export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers).value!
2050
+ end
2051
+
2052
+ #
2053
+ # Export all the devices in an IotHub.
2054
+ #
2055
+ # Export all the devices in an IotHub.
2056
+ #
2057
+ # @param resource_group_name [String] The name of the resource group.
2058
+ # @param resource_name [String] The name of the resource.
2059
+ # @param export_devices_parameters [ExportDevicesRequest] The export devices
2060
+ # parameters.
2061
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2062
+ # to the HTTP request.
2063
+ #
2064
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2065
+ #
2066
+ def export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers = nil)
2067
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2068
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2069
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2070
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2071
+ fail ArgumentError, 'export_devices_parameters is nil' if export_devices_parameters.nil?
2072
+
2073
+
2074
+ request_headers = {}
2075
+
2076
+ # Set Headers
2077
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2078
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2079
+
2080
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2081
+
2082
+ # Serialize Request
2083
+ request_mapper = ExportDevicesRequest.mapper()
2084
+ request_content = @client.serialize(request_mapper, export_devices_parameters, 'export_devices_parameters')
2085
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2086
+
2087
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'
2088
+ options = {
2089
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2090
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2091
+ query_params: {'api-version' => @client.api_version},
2092
+ body: request_content,
2093
+ headers: request_headers.merge(custom_headers || {})
2094
+ }
2095
+
2096
+ request_url = @base_url || @client.base_url
2097
+
2098
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
2099
+ promise = request.run_promise do |req|
2100
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2101
+ end
2102
+
2103
+ promise = promise.then do |http_response|
2104
+ status_code = http_response.status
2105
+ response_content = http_response.body
2106
+ unless status_code == 200
2107
+ error_model = JSON.load(response_content)
2108
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2109
+ end
2110
+
2111
+ # Create Result
2112
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2113
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2114
+ # Deserialize Response
2115
+ if status_code == 200
2116
+ begin
2117
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2118
+ result_mapper = JobResponse.mapper()
2119
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2120
+ rescue Exception => e
2121
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2122
+ end
2123
+ end
2124
+
2125
+ result
2126
+ end
2127
+
2128
+ promise.execute
2129
+ end
2130
+
2131
+ #
2132
+ # Import all the devices in an IotHub.
2133
+ #
2134
+ # Import all the devices in an IotHub.
2135
+ #
2136
+ # @param resource_group_name [String] The name of the resource group.
2137
+ # @param resource_name [String] The name of the resource.
2138
+ # @param import_devices_parameters [ImportDevicesRequest] The import devices
2139
+ # parameters.
2140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2141
+ # will be added to the HTTP request.
2142
+ #
2143
+ # @return [JobResponse] operation results.
2144
+ #
2145
+ def import_devices(resource_group_name, resource_name, import_devices_parameters, custom_headers = nil)
2146
+ response = import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers).value!
2147
+ response.body unless response.nil?
2148
+ end
2149
+
2150
+ #
2151
+ # Import all the devices in an IotHub.
2152
+ #
2153
+ # Import all the devices in an IotHub.
2154
+ #
2155
+ # @param resource_group_name [String] The name of the resource group.
2156
+ # @param resource_name [String] The name of the resource.
2157
+ # @param import_devices_parameters [ImportDevicesRequest] The import devices
2158
+ # parameters.
2159
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2160
+ # will be added to the HTTP request.
2161
+ #
2162
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2163
+ #
2164
+ def import_devices_with_http_info(resource_group_name, resource_name, import_devices_parameters, custom_headers = nil)
2165
+ import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers).value!
2166
+ end
2167
+
2168
+ #
2169
+ # Import all the devices in an IotHub.
2170
+ #
2171
+ # Import all the devices in an IotHub.
2172
+ #
2173
+ # @param resource_group_name [String] The name of the resource group.
2174
+ # @param resource_name [String] The name of the resource.
2175
+ # @param import_devices_parameters [ImportDevicesRequest] The import devices
2176
+ # parameters.
2177
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2178
+ # to the HTTP request.
2179
+ #
2180
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2181
+ #
2182
+ def import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers = nil)
2183
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2184
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2185
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2186
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2187
+ fail ArgumentError, 'import_devices_parameters is nil' if import_devices_parameters.nil?
2188
+
2189
+
2190
+ request_headers = {}
2191
+
2192
+ # Set Headers
2193
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2194
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2195
+
2196
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2197
+
2198
+ # Serialize Request
2199
+ request_mapper = ImportDevicesRequest.mapper()
2200
+ request_content = @client.serialize(request_mapper, import_devices_parameters, 'import_devices_parameters')
2201
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2202
+
2203
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'
2204
+ options = {
2205
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2206
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2207
+ query_params: {'api-version' => @client.api_version},
2208
+ body: request_content,
2209
+ headers: request_headers.merge(custom_headers || {})
2210
+ }
2211
+
2212
+ request_url = @base_url || @client.base_url
2213
+
2214
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
2215
+ promise = request.run_promise do |req|
2216
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2217
+ end
2218
+
2219
+ promise = promise.then do |http_response|
2220
+ status_code = http_response.status
2221
+ response_content = http_response.body
2222
+ unless status_code == 200
2223
+ error_model = JSON.load(response_content)
2224
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2225
+ end
2226
+
2227
+ # Create Result
2228
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2229
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2230
+ # Deserialize Response
2231
+ if status_code == 200
2232
+ begin
2233
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2234
+ result_mapper = JobResponse.mapper()
2235
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2236
+ rescue Exception => e
2237
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2238
+ end
2239
+ end
2240
+
2241
+ result
2242
+ end
2243
+
2244
+ promise.execute
2245
+ end
2246
+
2247
+ #
2248
+ # Get all IotHubs in a subscription.
2249
+ #
2250
+ # Get all IotHubs in a subscription.
2251
+ #
2252
+ # @param next_page_link [String] The NextLink from the previous successful
2253
+ # call to List operation.
2254
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2255
+ # will be added to the HTTP request.
2256
+ #
2257
+ # @return [IotHubDescriptionListResult] operation results.
2258
+ #
2259
+ def list_by_subscription_next(next_page_link, custom_headers = nil)
2260
+ response = list_by_subscription_next_async(next_page_link, custom_headers).value!
2261
+ response.body unless response.nil?
2262
+ end
2263
+
2264
+ #
2265
+ # Get all IotHubs in a subscription.
2266
+ #
2267
+ # Get all IotHubs in a subscription.
2268
+ #
2269
+ # @param next_page_link [String] The NextLink from the previous successful
2270
+ # call to List operation.
2271
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2272
+ # will be added to the HTTP request.
2273
+ #
2274
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2275
+ #
2276
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers = nil)
2277
+ list_by_subscription_next_async(next_page_link, custom_headers).value!
2278
+ end
2279
+
2280
+ #
2281
+ # Get all IotHubs in a subscription.
2282
+ #
2283
+ # Get all IotHubs in a subscription.
2284
+ #
2285
+ # @param next_page_link [String] The NextLink from the previous successful
2286
+ # call to List operation.
2287
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2288
+ # to the HTTP request.
2289
+ #
2290
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2291
+ #
2292
+ def list_by_subscription_next_async(next_page_link, custom_headers = nil)
2293
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2294
+
2295
+
2296
+ request_headers = {}
2297
+
2298
+ # Set Headers
2299
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2300
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2301
+ path_template = '{nextLink}'
2302
+ options = {
2303
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2304
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2305
+ headers: request_headers.merge(custom_headers || {})
2306
+ }
2307
+
2308
+ request_url = @base_url || @client.base_url
2309
+
2310
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
2311
+ promise = request.run_promise do |req|
2312
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2313
+ end
2314
+
2315
+ promise = promise.then do |http_response|
2316
+ status_code = http_response.status
2317
+ response_content = http_response.body
2318
+ unless status_code == 200
2319
+ error_model = JSON.load(response_content)
2320
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2321
+ end
2322
+
2323
+ # Create Result
2324
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2325
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2326
+ # Deserialize Response
2327
+ if status_code == 200
2328
+ begin
2329
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2330
+ result_mapper = IotHubDescriptionListResult.mapper()
2331
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2332
+ rescue Exception => e
2333
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2334
+ end
2335
+ end
2336
+
2337
+ result
2338
+ end
2339
+
2340
+ promise.execute
2341
+ end
2342
+
2343
+ #
2344
+ # Get all IotHubs in a Resourcegroup.
2345
+ #
2346
+ # Get all IotHubs in a Resource group.
2347
+ #
2348
+ # @param next_page_link [String] The NextLink from the previous successful
2349
+ # call to List operation.
2350
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2351
+ # will be added to the HTTP request.
2352
+ #
2353
+ # @return [IotHubDescriptionListResult] operation results.
2354
+ #
2355
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
2356
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
2357
+ response.body unless response.nil?
2358
+ end
2359
+
2360
+ #
2361
+ # Get all IotHubs in a Resourcegroup.
2362
+ #
2363
+ # Get all IotHubs in a Resource group.
2364
+ #
2365
+ # @param next_page_link [String] The NextLink from the previous successful
2366
+ # call to List operation.
2367
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2368
+ # will be added to the HTTP request.
2369
+ #
2370
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2371
+ #
2372
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
2373
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
2374
+ end
2375
+
2376
+ #
2377
+ # Get all IotHubs in a Resourcegroup.
2378
+ #
2379
+ # Get all IotHubs in a Resource group.
2380
+ #
2381
+ # @param next_page_link [String] The NextLink from the previous successful
2382
+ # call to List operation.
2383
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2384
+ # to the HTTP request.
2385
+ #
2386
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2387
+ #
2388
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
2389
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2390
+
2391
+
2392
+ request_headers = {}
2393
+
2394
+ # Set Headers
2395
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2396
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2397
+ path_template = '{nextLink}'
2398
+ options = {
2399
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2400
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2401
+ headers: request_headers.merge(custom_headers || {})
2402
+ }
2403
+
2404
+ request_url = @base_url || @client.base_url
2405
+
2406
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
2407
+ promise = request.run_promise do |req|
2408
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2409
+ end
2410
+
2411
+ promise = promise.then do |http_response|
2412
+ status_code = http_response.status
2413
+ response_content = http_response.body
2414
+ unless status_code == 200
2415
+ error_model = JSON.load(response_content)
2416
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2417
+ end
2418
+
2419
+ # Create Result
2420
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2421
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2422
+ # Deserialize Response
2423
+ if status_code == 200
2424
+ begin
2425
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2426
+ result_mapper = IotHubDescriptionListResult.mapper()
2427
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2428
+ rescue Exception => e
2429
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2430
+ end
2431
+ end
2432
+
2433
+ result
2434
+ end
2435
+
2436
+ promise.execute
2437
+ end
2438
+
2439
+ #
2440
+ # Get Valid Skus.
2441
+ #
2442
+ # Get Valid Skus.
2443
+ #
2444
+ # @param next_page_link [String] The NextLink from the previous successful
2445
+ # call to List operation.
2446
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2447
+ # will be added to the HTTP request.
2448
+ #
2449
+ # @return [IotHubSkuDescriptionListResult] operation results.
2450
+ #
2451
+ def get_valid_skus_next(next_page_link, custom_headers = nil)
2452
+ response = get_valid_skus_next_async(next_page_link, custom_headers).value!
2453
+ response.body unless response.nil?
2454
+ end
2455
+
2456
+ #
2457
+ # Get Valid Skus.
2458
+ #
2459
+ # Get Valid Skus.
2460
+ #
2461
+ # @param next_page_link [String] The NextLink from the previous successful
2462
+ # call to List operation.
2463
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2464
+ # will be added to the HTTP request.
2465
+ #
2466
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2467
+ #
2468
+ def get_valid_skus_next_with_http_info(next_page_link, custom_headers = nil)
2469
+ get_valid_skus_next_async(next_page_link, custom_headers).value!
2470
+ end
2471
+
2472
+ #
2473
+ # Get Valid Skus.
2474
+ #
2475
+ # Get Valid Skus.
2476
+ #
2477
+ # @param next_page_link [String] The NextLink from the previous successful
2478
+ # call to List operation.
2479
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2480
+ # to the HTTP request.
2481
+ #
2482
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2483
+ #
2484
+ def get_valid_skus_next_async(next_page_link, custom_headers = nil)
2485
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2486
+
2487
+
2488
+ request_headers = {}
2489
+
2490
+ # Set Headers
2491
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2492
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2493
+ path_template = '{nextLink}'
2494
+ options = {
2495
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2496
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2497
+ headers: request_headers.merge(custom_headers || {})
2498
+ }
2499
+
2500
+ request_url = @base_url || @client.base_url
2501
+
2502
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
2503
+ promise = request.run_promise do |req|
2504
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2505
+ end
2506
+
2507
+ promise = promise.then do |http_response|
2508
+ status_code = http_response.status
2509
+ response_content = http_response.body
2510
+ unless status_code == 200
2511
+ error_model = JSON.load(response_content)
2512
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2513
+ end
2514
+
2515
+ # Create Result
2516
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2517
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2518
+ # Deserialize Response
2519
+ if status_code == 200
2520
+ begin
2521
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2522
+ result_mapper = IotHubSkuDescriptionListResult.mapper()
2523
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2524
+ rescue Exception => e
2525
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2526
+ end
2527
+ end
2528
+
2529
+ result
2530
+ end
2531
+
2532
+ promise.execute
2533
+ end
2534
+
2535
+ #
2536
+ # Get EventHub Consumer Groups for an IotHub.
2537
+ #
2538
+ # Get EventHub Consumer Groups for an IotHub.
2539
+ #
2540
+ # @param next_page_link [String] The NextLink from the previous successful
2541
+ # call to List operation.
2542
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2543
+ # will be added to the HTTP request.
2544
+ #
2545
+ # @return [EventHubConsumerGroupsListResult] operation results.
2546
+ #
2547
+ def list_event_hub_consumer_groups_next(next_page_link, custom_headers = nil)
2548
+ response = list_event_hub_consumer_groups_next_async(next_page_link, custom_headers).value!
2549
+ response.body unless response.nil?
2550
+ end
2551
+
2552
+ #
2553
+ # Get EventHub Consumer Groups for an IotHub.
2554
+ #
2555
+ # Get EventHub Consumer Groups for an IotHub.
2556
+ #
2557
+ # @param next_page_link [String] The NextLink from the previous successful
2558
+ # call to List operation.
2559
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2560
+ # will be added to the HTTP request.
2561
+ #
2562
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2563
+ #
2564
+ def list_event_hub_consumer_groups_next_with_http_info(next_page_link, custom_headers = nil)
2565
+ list_event_hub_consumer_groups_next_async(next_page_link, custom_headers).value!
2566
+ end
2567
+
2568
+ #
2569
+ # Get EventHub Consumer Groups for an IotHub.
2570
+ #
2571
+ # Get EventHub Consumer Groups for an IotHub.
2572
+ #
2573
+ # @param next_page_link [String] The NextLink from the previous successful
2574
+ # call to List operation.
2575
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2576
+ # to the HTTP request.
2577
+ #
2578
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2579
+ #
2580
+ def list_event_hub_consumer_groups_next_async(next_page_link, custom_headers = nil)
2581
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2582
+
2583
+
2584
+ request_headers = {}
2585
+
2586
+ # Set Headers
2587
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2588
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2589
+ path_template = '{nextLink}'
2590
+ options = {
2591
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2592
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2593
+ headers: request_headers.merge(custom_headers || {})
2594
+ }
2595
+
2596
+ request_url = @base_url || @client.base_url
2597
+
2598
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
2599
+ promise = request.run_promise do |req|
2600
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2601
+ end
2602
+
2603
+ promise = promise.then do |http_response|
2604
+ status_code = http_response.status
2605
+ response_content = http_response.body
2606
+ unless status_code == 200
2607
+ error_model = JSON.load(response_content)
2608
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2609
+ end
2610
+
2611
+ # Create Result
2612
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2613
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2614
+ # Deserialize Response
2615
+ if status_code == 200
2616
+ begin
2617
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2618
+ result_mapper = EventHubConsumerGroupsListResult.mapper()
2619
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2620
+ rescue Exception => e
2621
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2622
+ end
2623
+ end
2624
+
2625
+ result
2626
+ end
2627
+
2628
+ promise.execute
2629
+ end
2630
+
2631
+ #
2632
+ # Get all the jobs in an IotHub.
2633
+ #
2634
+ # Get all the jobs in an IotHub.
2635
+ #
2636
+ # @param next_page_link [String] The NextLink from the previous successful
2637
+ # call to List operation.
2638
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2639
+ # will be added to the HTTP request.
2640
+ #
2641
+ # @return [JobResponseListResult] operation results.
2642
+ #
2643
+ def list_jobs_next(next_page_link, custom_headers = nil)
2644
+ response = list_jobs_next_async(next_page_link, custom_headers).value!
2645
+ response.body unless response.nil?
2646
+ end
2647
+
2648
+ #
2649
+ # Get all the jobs in an IotHub.
2650
+ #
2651
+ # Get all the jobs in an IotHub.
2652
+ #
2653
+ # @param next_page_link [String] The NextLink from the previous successful
2654
+ # call to List operation.
2655
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2656
+ # will be added to the HTTP request.
2657
+ #
2658
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2659
+ #
2660
+ def list_jobs_next_with_http_info(next_page_link, custom_headers = nil)
2661
+ list_jobs_next_async(next_page_link, custom_headers).value!
2662
+ end
2663
+
2664
+ #
2665
+ # Get all the jobs in an IotHub.
2666
+ #
2667
+ # Get all the jobs in an IotHub.
2668
+ #
2669
+ # @param next_page_link [String] The NextLink from the previous successful
2670
+ # call to List operation.
2671
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2672
+ # to the HTTP request.
2673
+ #
2674
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2675
+ #
2676
+ def list_jobs_next_async(next_page_link, custom_headers = nil)
2677
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2678
+
2679
+
2680
+ request_headers = {}
2681
+
2682
+ # Set Headers
2683
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2684
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2685
+ path_template = '{nextLink}'
2686
+ options = {
2687
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2688
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2689
+ headers: request_headers.merge(custom_headers || {})
2690
+ }
2691
+
2692
+ request_url = @base_url || @client.base_url
2693
+
2694
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
2695
+ promise = request.run_promise do |req|
2696
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2697
+ end
2698
+
2699
+ promise = promise.then do |http_response|
2700
+ status_code = http_response.status
2701
+ response_content = http_response.body
2702
+ unless status_code == 200
2703
+ error_model = JSON.load(response_content)
2704
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2705
+ end
2706
+
2707
+ # Create Result
2708
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2709
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2710
+ # Deserialize Response
2711
+ if status_code == 200
2712
+ begin
2713
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2714
+ result_mapper = JobResponseListResult.mapper()
2715
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2716
+ rescue Exception => e
2717
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2718
+ end
2719
+ end
2720
+
2721
+ result
2722
+ end
2723
+
2724
+ promise.execute
2725
+ end
2726
+
2727
+ #
2728
+ # Get quota metrics for an IotHub.
2729
+ #
2730
+ # Get quota metrics for an IotHub.
2731
+ #
2732
+ # @param next_page_link [String] The NextLink from the previous successful
2733
+ # call to List operation.
2734
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2735
+ # will be added to the HTTP request.
2736
+ #
2737
+ # @return [IotHubQuotaMetricInfoListResult] operation results.
2738
+ #
2739
+ def get_quota_metrics_next(next_page_link, custom_headers = nil)
2740
+ response = get_quota_metrics_next_async(next_page_link, custom_headers).value!
2741
+ response.body unless response.nil?
2742
+ end
2743
+
2744
+ #
2745
+ # Get quota metrics for an IotHub.
2746
+ #
2747
+ # Get quota metrics for an IotHub.
2748
+ #
2749
+ # @param next_page_link [String] The NextLink from the previous successful
2750
+ # call to List operation.
2751
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2752
+ # will be added to the HTTP request.
2753
+ #
2754
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2755
+ #
2756
+ def get_quota_metrics_next_with_http_info(next_page_link, custom_headers = nil)
2757
+ get_quota_metrics_next_async(next_page_link, custom_headers).value!
2758
+ end
2759
+
2760
+ #
2761
+ # Get quota metrics for an IotHub.
2762
+ #
2763
+ # Get quota metrics for an IotHub.
2764
+ #
2765
+ # @param next_page_link [String] The NextLink from the previous successful
2766
+ # call to List operation.
2767
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2768
+ # to the HTTP request.
2769
+ #
2770
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2771
+ #
2772
+ def get_quota_metrics_next_async(next_page_link, custom_headers = nil)
2773
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2774
+
2775
+
2776
+ request_headers = {}
2777
+
2778
+ # Set Headers
2779
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2780
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2781
+ path_template = '{nextLink}'
2782
+ options = {
2783
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2784
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2785
+ headers: request_headers.merge(custom_headers || {})
2786
+ }
2787
+
2788
+ request_url = @base_url || @client.base_url
2789
+
2790
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
2791
+ promise = request.run_promise do |req|
2792
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2793
+ end
2794
+
2795
+ promise = promise.then do |http_response|
2796
+ status_code = http_response.status
2797
+ response_content = http_response.body
2798
+ unless status_code == 200
2799
+ error_model = JSON.load(response_content)
2800
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2801
+ end
2802
+
2803
+ # Create Result
2804
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2805
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2806
+ # Deserialize Response
2807
+ if status_code == 200
2808
+ begin
2809
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2810
+ result_mapper = IotHubQuotaMetricInfoListResult.mapper()
2811
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2812
+ rescue Exception => e
2813
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2814
+ end
2815
+ end
2816
+
2817
+ result
2818
+ end
2819
+
2820
+ promise.execute
2821
+ end
2822
+
2823
+ #
2824
+ # Get all keys for an IotHub.
2825
+ #
2826
+ # Get all keys for an IotHub.
2827
+ #
2828
+ # @param next_page_link [String] The NextLink from the previous successful
2829
+ # call to List operation.
2830
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2831
+ # will be added to the HTTP request.
2832
+ #
2833
+ # @return [SharedAccessSignatureAuthorizationRuleListResult] operation results.
2834
+ #
2835
+ def list_keys_next(next_page_link, custom_headers = nil)
2836
+ response = list_keys_next_async(next_page_link, custom_headers).value!
2837
+ response.body unless response.nil?
2838
+ end
2839
+
2840
+ #
2841
+ # Get all keys for an IotHub.
2842
+ #
2843
+ # Get all keys for an IotHub.
2844
+ #
2845
+ # @param next_page_link [String] The NextLink from the previous successful
2846
+ # call to List operation.
2847
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2848
+ # will be added to the HTTP request.
2849
+ #
2850
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2851
+ #
2852
+ def list_keys_next_with_http_info(next_page_link, custom_headers = nil)
2853
+ list_keys_next_async(next_page_link, custom_headers).value!
2854
+ end
2855
+
2856
+ #
2857
+ # Get all keys for an IotHub.
2858
+ #
2859
+ # Get all keys for an IotHub.
2860
+ #
2861
+ # @param next_page_link [String] The NextLink from the previous successful
2862
+ # call to List operation.
2863
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2864
+ # to the HTTP request.
2865
+ #
2866
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2867
+ #
2868
+ def list_keys_next_async(next_page_link, custom_headers = nil)
2869
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2870
+
2871
+
2872
+ request_headers = {}
2873
+
2874
+ # Set Headers
2875
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2876
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2877
+ path_template = '{nextLink}'
2878
+ options = {
2879
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2880
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2881
+ headers: request_headers.merge(custom_headers || {})
2882
+ }
2883
+
2884
+ request_url = @base_url || @client.base_url
2885
+
2886
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
2887
+ promise = request.run_promise do |req|
2888
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2889
+ end
2890
+
2891
+ promise = promise.then do |http_response|
2892
+ status_code = http_response.status
2893
+ response_content = http_response.body
2894
+ unless status_code == 200
2895
+ error_model = JSON.load(response_content)
2896
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2897
+ end
2898
+
2899
+ # Create Result
2900
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2901
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2902
+ # Deserialize Response
2903
+ if status_code == 200
2904
+ begin
2905
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2906
+ result_mapper = SharedAccessSignatureAuthorizationRuleListResult.mapper()
2907
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2908
+ rescue Exception => e
2909
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2910
+ end
2911
+ end
2912
+
2913
+ result
2914
+ end
2915
+
2916
+ promise.execute
2917
+ end
2918
+
2919
+ end
2920
+ end