azure_mgmt_iot_hub 0.17.4 → 0.17.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-02-03/generated/azure_mgmt_iot_hub/iot_hub_client.rb +1 -1
  3. data/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_client.rb +1 -1
  4. data/lib/2017-07-01/generated/azure_mgmt_iot_hub/iot_hub_client.rb +1 -1
  5. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_client.rb +1 -1
  6. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/iot_hub_client.rb +1 -1
  7. data/lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_client.rb +1 -1
  8. data/lib/2019-03-22-preview/generated/azure_mgmt_iot_hub/iot_hub_client.rb +1 -1
  9. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub.rb +114 -0
  10. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/certificates.rb +723 -0
  11. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/iot_hub.rb +172 -0
  12. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/iot_hub_client.rb +147 -0
  13. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb +3738 -0
  14. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/access_rights.rb +29 -0
  15. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/capabilities.rb +16 -0
  16. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/certificate_body_description.rb +47 -0
  17. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/certificate_description.rb +95 -0
  18. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/certificate_list_description.rb +56 -0
  19. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/certificate_properties.rb +118 -0
  20. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/certificate_properties_with_nonce.rb +133 -0
  21. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/certificate_verification_description.rb +47 -0
  22. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/certificate_with_nonce_description.rb +95 -0
  23. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb +77 -0
  24. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/endpoint_health_data.rb +69 -0
  25. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/endpoint_health_data_list_result.rb +100 -0
  26. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/endpoint_health_status.rb +18 -0
  27. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/enrichment_properties.rb +81 -0
  28. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/error_details.rb +83 -0
  29. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/event_hub_consumer_group_info.rb +102 -0
  30. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/event_hub_consumer_groups_list_result.rb +101 -0
  31. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/event_hub_properties.rb +107 -0
  32. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/export_devices_request.rb +59 -0
  33. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/failover_input.rb +46 -0
  34. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/fallback_route_properties.rb +114 -0
  35. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/feedback_properties.rb +77 -0
  36. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/import_devices_request.rb +58 -0
  37. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_capacity.rb +89 -0
  38. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_description.rb +126 -0
  39. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_description_list_result.rb +100 -0
  40. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_location_description.rb +59 -0
  41. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_name_availability_info.rb +73 -0
  42. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_name_unavailability_reason.rb +16 -0
  43. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb +275 -0
  44. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_properties_device_streams.rb +54 -0
  45. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info.rb +71 -0
  46. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info_list_result.rb +101 -0
  47. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_replica_role_type.rb +16 -0
  48. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_scale_type.rb +17 -0
  49. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_sku.rb +21 -0
  50. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description.rb +71 -0
  51. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description_list_result.rb +101 -0
  52. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb +73 -0
  53. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/iot_hub_sku_tier.rb +17 -0
  54. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/ip_filter_action_type.rb +16 -0
  55. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/ip_filter_rule.rb +71 -0
  56. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/job_response.rb +137 -0
  57. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/job_response_list_result.rb +99 -0
  58. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/job_status.rb +20 -0
  59. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/job_type.rb +24 -0
  60. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/matched_route.rb +47 -0
  61. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb +77 -0
  62. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/name.rb +57 -0
  63. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/operation.rb +60 -0
  64. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/operation_display.rb +83 -0
  65. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/operation_inputs.rb +46 -0
  66. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/operation_list_result.rb +103 -0
  67. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/registry_statistics.rb +73 -0
  68. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/resource.rb +113 -0
  69. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/route_compilation_error.rb +70 -0
  70. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/route_error_position.rb +57 -0
  71. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/route_error_range.rb +59 -0
  72. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/route_error_severity.rb +16 -0
  73. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/route_properties.rb +116 -0
  74. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_endpoints.rb +126 -0
  75. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_event_hub_properties.rb +87 -0
  76. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_message.rb +84 -0
  77. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_properties.rb +110 -0
  78. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_service_bus_queue_endpoint_properties.rb +90 -0
  79. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_service_bus_topic_endpoint_properties.rb +90 -0
  80. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_source.rb +20 -0
  81. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_storage_container_properties.rb +157 -0
  82. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_twin.rb +58 -0
  83. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/routing_twin_properties.rb +58 -0
  84. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb +89 -0
  85. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule_list_result.rb +103 -0
  86. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb +73 -0
  87. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/tags_resource.rb +55 -0
  88. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/test_all_routes_input.rb +73 -0
  89. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/test_all_routes_result.rb +55 -0
  90. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/test_result_status.rb +17 -0
  91. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/test_route_input.rb +71 -0
  92. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/test_route_result.rb +59 -0
  93. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/test_route_result_details.rb +56 -0
  94. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/user_subscription_quota.rb +102 -0
  95. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/models/user_subscription_quota_list_result.rb +67 -0
  96. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/module_definition.rb +9 -0
  97. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/operations.rb +219 -0
  98. data/lib/2019-07-01-preview/generated/azure_mgmt_iot_hub/resource_provider_common.rb +117 -0
  99. data/lib/azure_mgmt_iot_hub.rb +5 -4
  100. data/lib/version.rb +1 -1
  101. metadata +93 -3
@@ -0,0 +1,172 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::IotHub::Mgmt::V2019_07_01_preview
7
+ #
8
+ # Use this API to manage the IoT hubs in your Azure subscription.
9
+ #
10
+ class IotHub
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the IotHub class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [IotHubClient] reference to the IotHubClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Manual Failover Fail over
26
+ #
27
+ # Perform manual fail over of given hub
28
+ #
29
+ # @param iot_hub_name [String] IotHub to fail over
30
+ # @param failover_input [FailoverInput] Region to failover to. Must be a azure
31
+ # DR pair
32
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ def manual_failover(iot_hub_name, failover_input, resource_group_name, custom_headers:nil)
37
+ response = manual_failover_async(iot_hub_name, failover_input, resource_group_name, custom_headers:custom_headers).value!
38
+ nil
39
+ end
40
+
41
+ #
42
+ # @param iot_hub_name [String] IotHub to fail over
43
+ # @param failover_input [FailoverInput] Region to failover to. Must be a azure
44
+ # DR pair
45
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [Concurrent::Promise] promise which provides async access to http
50
+ # response.
51
+ #
52
+ def manual_failover_async(iot_hub_name, failover_input, resource_group_name, custom_headers:nil)
53
+ # Send request
54
+ promise = begin_manual_failover_async(iot_hub_name, failover_input, resource_group_name, custom_headers:custom_headers)
55
+
56
+ promise = promise.then do |response|
57
+ # Defining deserialization method.
58
+ deserialize_method = lambda do |parsed_response|
59
+ end
60
+
61
+ # Waiting for response.
62
+ @client.get_long_running_operation_result(response, deserialize_method)
63
+ end
64
+
65
+ promise
66
+ end
67
+
68
+ #
69
+ # Manual Failover Fail over
70
+ #
71
+ # Perform manual fail over of given hub
72
+ #
73
+ # @param iot_hub_name [String] IotHub to fail over
74
+ # @param failover_input [FailoverInput] Region to failover to. Must be a azure
75
+ # DR pair
76
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
77
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
78
+ # will be added to the HTTP request.
79
+ #
80
+ #
81
+ def begin_manual_failover(iot_hub_name, failover_input, resource_group_name, custom_headers:nil)
82
+ response = begin_manual_failover_async(iot_hub_name, failover_input, resource_group_name, custom_headers:custom_headers).value!
83
+ nil
84
+ end
85
+
86
+ #
87
+ # Manual Failover Fail over
88
+ #
89
+ # Perform manual fail over of given hub
90
+ #
91
+ # @param iot_hub_name [String] IotHub to fail over
92
+ # @param failover_input [FailoverInput] Region to failover to. Must be a azure
93
+ # DR pair
94
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
95
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
96
+ # will be added to the HTTP request.
97
+ #
98
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
99
+ #
100
+ def begin_manual_failover_with_http_info(iot_hub_name, failover_input, resource_group_name, custom_headers:nil)
101
+ begin_manual_failover_async(iot_hub_name, failover_input, resource_group_name, custom_headers:custom_headers).value!
102
+ end
103
+
104
+ #
105
+ # Manual Failover Fail over
106
+ #
107
+ # Perform manual fail over of given hub
108
+ #
109
+ # @param iot_hub_name [String] IotHub to fail over
110
+ # @param failover_input [FailoverInput] Region to failover to. Must be a azure
111
+ # DR pair
112
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
113
+ # @param [Hash{String => String}] A hash of custom headers that will be added
114
+ # to the HTTP request.
115
+ #
116
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
117
+ #
118
+ def begin_manual_failover_async(iot_hub_name, failover_input, resource_group_name, custom_headers:nil)
119
+ fail ArgumentError, 'iot_hub_name is nil' if iot_hub_name.nil?
120
+ fail ArgumentError, 'failover_input is nil' if failover_input.nil?
121
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
122
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
123
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
124
+
125
+
126
+ request_headers = {}
127
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
128
+
129
+ # Set Headers
130
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
131
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
132
+
133
+ # Serialize Request
134
+ request_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::FailoverInput.mapper()
135
+ request_content = @client.serialize(request_mapper, failover_input)
136
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
137
+
138
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'
139
+
140
+ request_url = @base_url || @client.base_url
141
+
142
+ options = {
143
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
144
+ path_params: {'iotHubName' => iot_hub_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
145
+ query_params: {'api-version' => @client.api_version},
146
+ body: request_content,
147
+ headers: request_headers.merge(custom_headers || {}),
148
+ base_url: request_url
149
+ }
150
+ promise = @client.make_request_async(:post, path_template, options)
151
+
152
+ promise = promise.then do |result|
153
+ http_response = result.response
154
+ status_code = http_response.status
155
+ response_content = http_response.body
156
+ unless status_code == 200 || status_code == 202
157
+ error_model = JSON.load(response_content)
158
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
159
+ end
160
+
161
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
162
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
163
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
164
+
165
+ result
166
+ end
167
+
168
+ promise.execute
169
+ end
170
+
171
+ end
172
+ end
@@ -0,0 +1,147 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::IotHub::Mgmt::V2019_07_01_preview
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] The version of the API.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [Operations] operations
39
+ attr_reader :operations
40
+
41
+ # @return [IotHubResource] iot_hub_resource
42
+ attr_reader :iot_hub_resource
43
+
44
+ # @return [ResourceProviderCommon] resource_provider_common
45
+ attr_reader :resource_provider_common
46
+
47
+ # @return [Certificates] certificates
48
+ attr_reader :certificates
49
+
50
+ # @return [IotHub] iot_hub
51
+ attr_reader :iot_hub
52
+
53
+ #
54
+ # Creates initializes a new instance of the IotHubClient class.
55
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
56
+ # @param base_url [String] the base URI of the service.
57
+ # @param options [Array] filters to be applied to the HTTP requests.
58
+ #
59
+ def initialize(credentials = nil, base_url = nil, options = nil)
60
+ super(credentials, options)
61
+ @base_url = base_url || 'https://management.azure.com'
62
+
63
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
64
+ @credentials = credentials
65
+
66
+ @operations = Operations.new(self)
67
+ @iot_hub_resource = IotHubResource.new(self)
68
+ @resource_provider_common = ResourceProviderCommon.new(self)
69
+ @certificates = Certificates.new(self)
70
+ @iot_hub = IotHub.new(self)
71
+ @api_version = '2019-07-01-preview'
72
+ @accept_language = 'en-US'
73
+ @long_running_operation_retry_timeout = 30
74
+ @generate_client_request_id = true
75
+ add_telemetry
76
+ end
77
+
78
+ #
79
+ # Makes a request and returns the body of the response.
80
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
81
+ # @param path [String] the path, relative to {base_url}.
82
+ # @param options [Hash{String=>String}] specifying any request options like :body.
83
+ # @return [Hash{String=>String}] containing the body of the response.
84
+ # Example:
85
+ #
86
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
87
+ # path = "/path"
88
+ # options = {
89
+ # body: request_content,
90
+ # query_params: {'api-version' => '2016-02-01'}
91
+ # }
92
+ # result = @client.make_request(:put, path, options)
93
+ #
94
+ def make_request(method, path, options = {})
95
+ result = make_request_with_http_info(method, path, options)
96
+ result.body unless result.nil?
97
+ end
98
+
99
+ #
100
+ # Makes a request and returns the operation response.
101
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
102
+ # @param path [String] the path, relative to {base_url}.
103
+ # @param options [Hash{String=>String}] specifying any request options like :body.
104
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
105
+ #
106
+ def make_request_with_http_info(method, path, options = {})
107
+ result = make_request_async(method, path, options).value!
108
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
109
+ result
110
+ end
111
+
112
+ #
113
+ # Makes a request asynchronously.
114
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
115
+ # @param path [String] the path, relative to {base_url}.
116
+ # @param options [Hash{String=>String}] specifying any request options like :body.
117
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
118
+ #
119
+ def make_request_async(method, path, options = {})
120
+ fail ArgumentError, 'method is nil' if method.nil?
121
+ fail ArgumentError, 'path is nil' if path.nil?
122
+
123
+ request_url = options[:base_url] || @base_url
124
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
125
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
126
+ end
127
+
128
+ request_headers = @request_headers
129
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
130
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
131
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
132
+
133
+ super(request_url, method, path, options)
134
+ end
135
+
136
+
137
+ private
138
+ #
139
+ # Adds telemetry information.
140
+ #
141
+ def add_telemetry
142
+ sdk_information = 'azure_mgmt_iot_hub'
143
+ sdk_information = "#{sdk_information}/0.17.5"
144
+ add_user_agent_information(sdk_information)
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,3738 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::IotHub::Mgmt::V2019_07_01_preview
7
+ #
8
+ # Use this API to manage the IoT hubs in your Azure subscription.
9
+ #
10
+ class IotHubResource
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the IotHubResource class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [IotHubClient] reference to the IotHubClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get the non-security related metadata of an IoT hub
26
+ #
27
+ # Get the non-security related metadata of an IoT hub.
28
+ #
29
+ # @param resource_group_name [String] The name of the resource group that
30
+ # contains the IoT hub.
31
+ # @param resource_name [String] The name of the IoT hub.
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:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Get the non-security related metadata of an IoT hub
44
+ #
45
+ # Get the non-security related metadata of an IoT hub.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group that
48
+ # contains the IoT hub.
49
+ # @param resource_name [String] The name of the IoT hub.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def get_with_http_info(resource_group_name, resource_name, custom_headers:nil)
56
+ get_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Get the non-security related metadata of an IoT hub
61
+ #
62
+ # Get the non-security related metadata of an IoT hub.
63
+ #
64
+ # @param resource_group_name [String] The name of the resource group that
65
+ # contains the IoT hub.
66
+ # @param resource_name [String] The name of the IoT hub.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def get_async(resource_group_name, resource_name, custom_headers:nil)
73
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
74
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
75
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
76
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
77
+
78
+
79
+ request_headers = {}
80
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
86
+
87
+ request_url = @base_url || @client.base_url
88
+
89
+ options = {
90
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
91
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
92
+ query_params: {'api-version' => @client.api_version},
93
+ headers: request_headers.merge(custom_headers || {}),
94
+ base_url: request_url
95
+ }
96
+ promise = @client.make_request_async(:get, path_template, options)
97
+
98
+ promise = promise.then do |result|
99
+ http_response = result.response
100
+ status_code = http_response.status
101
+ response_content = http_response.body
102
+ unless status_code == 200
103
+ error_model = JSON.load(response_content)
104
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
105
+ end
106
+
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
109
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
110
+ # Deserialize Response
111
+ if status_code == 200
112
+ begin
113
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
114
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescription.mapper()
115
+ result.body = @client.deserialize(result_mapper, parsed_response)
116
+ rescue Exception => e
117
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
118
+ end
119
+ end
120
+
121
+ result
122
+ end
123
+
124
+ promise.execute
125
+ end
126
+
127
+ #
128
+ # Create or update the metadata of an IoT hub.
129
+ #
130
+ # Create or update the metadata of an Iot hub. The usual pattern to modify a
131
+ # property is to retrieve the IoT hub metadata and security metadata, and then
132
+ # combine them with the modified values in a new body to update the IoT hub.
133
+ #
134
+ # @param resource_group_name [String] The name of the resource group that
135
+ # contains the IoT hub.
136
+ # @param resource_name [String] The name of the IoT hub.
137
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
138
+ # security metadata.
139
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
140
+ # brand new IoT Hub. Required to update an existing IoT Hub.
141
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
142
+ # will be added to the HTTP request.
143
+ #
144
+ # @return [IotHubDescription] operation results.
145
+ #
146
+ def create_or_update(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
147
+ response = create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers).value!
148
+ response.body unless response.nil?
149
+ end
150
+
151
+ #
152
+ # @param resource_group_name [String] The name of the resource group that
153
+ # contains the IoT hub.
154
+ # @param resource_name [String] The name of the IoT hub.
155
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
156
+ # security metadata.
157
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
158
+ # brand new IoT Hub. Required to update an existing IoT Hub.
159
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
160
+ # will be added to the HTTP request.
161
+ #
162
+ # @return [Concurrent::Promise] promise which provides async access to http
163
+ # response.
164
+ #
165
+ def create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
166
+ # Send request
167
+ promise = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers)
168
+
169
+ promise = promise.then do |response|
170
+ # Defining deserialization method.
171
+ deserialize_method = lambda do |parsed_response|
172
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescription.mapper()
173
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
174
+ end
175
+
176
+ # Waiting for response.
177
+ @client.get_long_running_operation_result(response, deserialize_method)
178
+ end
179
+
180
+ promise
181
+ end
182
+
183
+ #
184
+ # Update an existing IoT Hubs tags.
185
+ #
186
+ # Update an existing IoT Hub tags. to update other fields use the
187
+ # CreateOrUpdate method
188
+ #
189
+ # @param resource_group_name [String] Resource group identifier.
190
+ # @param resource_name [String] Name of iot hub to update.
191
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
192
+ # iot hub instance.
193
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
194
+ # will be added to the HTTP request.
195
+ #
196
+ # @return [IotHubDescription] operation results.
197
+ #
198
+ def update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
199
+ response = update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
200
+ response.body unless response.nil?
201
+ end
202
+
203
+ #
204
+ # @param resource_group_name [String] Resource group identifier.
205
+ # @param resource_name [String] Name of iot hub to update.
206
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
207
+ # iot hub instance.
208
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
209
+ # will be added to the HTTP request.
210
+ #
211
+ # @return [Concurrent::Promise] promise which provides async access to http
212
+ # response.
213
+ #
214
+ def update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
215
+ # Send request
216
+ promise = begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers)
217
+
218
+ promise = promise.then do |response|
219
+ # Defining deserialization method.
220
+ deserialize_method = lambda do |parsed_response|
221
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescription.mapper()
222
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
223
+ end
224
+
225
+ # Waiting for response.
226
+ @client.get_long_running_operation_result(response, deserialize_method)
227
+ end
228
+
229
+ promise
230
+ end
231
+
232
+ #
233
+ # Delete an IoT hub
234
+ #
235
+ # Delete an IoT hub.
236
+ #
237
+ # @param resource_group_name [String] The name of the resource group that
238
+ # contains the IoT hub.
239
+ # @param resource_name [String] The name of the IoT hub.
240
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
241
+ # will be added to the HTTP request.
242
+ #
243
+ # @return [Object] operation results.
244
+ #
245
+ def delete(resource_group_name, resource_name, custom_headers:nil)
246
+ response = delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
247
+ response.body unless response.nil?
248
+ end
249
+
250
+ #
251
+ # @param resource_group_name [String] The name of the resource group that
252
+ # contains the IoT hub.
253
+ # @param resource_name [String] The name of the IoT hub.
254
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
255
+ # will be added to the HTTP request.
256
+ #
257
+ # @return [Concurrent::Promise] promise which provides async access to http
258
+ # response.
259
+ #
260
+ def delete_async(resource_group_name, resource_name, custom_headers:nil)
261
+ # Send request
262
+ promise = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers)
263
+
264
+ promise = promise.then do |response|
265
+ # Defining deserialization method.
266
+ deserialize_method = lambda do |parsed_response|
267
+ result_mapper = {
268
+ client_side_validation: true,
269
+ required: false,
270
+ serialized_name: 'parsed_response',
271
+ type: {
272
+ name: 'Object'
273
+ }
274
+ }
275
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
276
+ end
277
+
278
+ # Waiting for response.
279
+ @client.get_long_running_operation_result(response, deserialize_method)
280
+ end
281
+
282
+ promise
283
+ end
284
+
285
+ #
286
+ # Get all the IoT hubs in a subscription
287
+ #
288
+ # Get all the IoT hubs in a subscription.
289
+ #
290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
291
+ # will be added to the HTTP request.
292
+ #
293
+ # @return [Array<IotHubDescription>] operation results.
294
+ #
295
+ def list_by_subscription(custom_headers:nil)
296
+ first_page = list_by_subscription_as_lazy(custom_headers:custom_headers)
297
+ first_page.get_all_items
298
+ end
299
+
300
+ #
301
+ # Get all the IoT hubs in a subscription
302
+ #
303
+ # Get all the IoT hubs in a subscription.
304
+ #
305
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
306
+ # will be added to the HTTP request.
307
+ #
308
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
309
+ #
310
+ def list_by_subscription_with_http_info(custom_headers:nil)
311
+ list_by_subscription_async(custom_headers:custom_headers).value!
312
+ end
313
+
314
+ #
315
+ # Get all the IoT hubs in a subscription
316
+ #
317
+ # Get all the IoT hubs in a subscription.
318
+ #
319
+ # @param [Hash{String => String}] A hash of custom headers that will be added
320
+ # to the HTTP request.
321
+ #
322
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
323
+ #
324
+ def list_by_subscription_async(custom_headers:nil)
325
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
326
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
327
+
328
+
329
+ request_headers = {}
330
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
331
+
332
+ # Set Headers
333
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
334
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
335
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'
336
+
337
+ request_url = @base_url || @client.base_url
338
+
339
+ options = {
340
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
341
+ path_params: {'subscriptionId' => @client.subscription_id},
342
+ query_params: {'api-version' => @client.api_version},
343
+ headers: request_headers.merge(custom_headers || {}),
344
+ base_url: request_url
345
+ }
346
+ promise = @client.make_request_async(:get, path_template, options)
347
+
348
+ promise = promise.then do |result|
349
+ http_response = result.response
350
+ status_code = http_response.status
351
+ response_content = http_response.body
352
+ unless status_code == 200
353
+ error_model = JSON.load(response_content)
354
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
355
+ end
356
+
357
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
358
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
359
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
360
+ # Deserialize Response
361
+ if status_code == 200
362
+ begin
363
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
364
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescriptionListResult.mapper()
365
+ result.body = @client.deserialize(result_mapper, parsed_response)
366
+ rescue Exception => e
367
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
368
+ end
369
+ end
370
+
371
+ result
372
+ end
373
+
374
+ promise.execute
375
+ end
376
+
377
+ #
378
+ # Get all the IoT hubs in a resource group
379
+ #
380
+ # Get all the IoT hubs in a resource group.
381
+ #
382
+ # @param resource_group_name [String] The name of the resource group that
383
+ # contains the IoT hub.
384
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
385
+ # will be added to the HTTP request.
386
+ #
387
+ # @return [Array<IotHubDescription>] operation results.
388
+ #
389
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
390
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
391
+ first_page.get_all_items
392
+ end
393
+
394
+ #
395
+ # Get all the IoT hubs in a resource group
396
+ #
397
+ # Get all the IoT hubs in a resource group.
398
+ #
399
+ # @param resource_group_name [String] The name of the resource group that
400
+ # contains the IoT hub.
401
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
402
+ # will be added to the HTTP request.
403
+ #
404
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
405
+ #
406
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
407
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
408
+ end
409
+
410
+ #
411
+ # Get all the IoT hubs in a resource group
412
+ #
413
+ # Get all the IoT hubs in a resource group.
414
+ #
415
+ # @param resource_group_name [String] The name of the resource group that
416
+ # contains the IoT hub.
417
+ # @param [Hash{String => String}] A hash of custom headers that will be added
418
+ # to the HTTP request.
419
+ #
420
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
421
+ #
422
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
423
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
424
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
425
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
426
+
427
+
428
+ request_headers = {}
429
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
430
+
431
+ # Set Headers
432
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
433
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
434
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'
435
+
436
+ request_url = @base_url || @client.base_url
437
+
438
+ options = {
439
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
440
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
441
+ query_params: {'api-version' => @client.api_version},
442
+ headers: request_headers.merge(custom_headers || {}),
443
+ base_url: request_url
444
+ }
445
+ promise = @client.make_request_async(:get, path_template, options)
446
+
447
+ promise = promise.then do |result|
448
+ http_response = result.response
449
+ status_code = http_response.status
450
+ response_content = http_response.body
451
+ unless status_code == 200
452
+ error_model = JSON.load(response_content)
453
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
454
+ end
455
+
456
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
457
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
458
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
459
+ # Deserialize Response
460
+ if status_code == 200
461
+ begin
462
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
463
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescriptionListResult.mapper()
464
+ result.body = @client.deserialize(result_mapper, parsed_response)
465
+ rescue Exception => e
466
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
467
+ end
468
+ end
469
+
470
+ result
471
+ end
472
+
473
+ promise.execute
474
+ end
475
+
476
+ #
477
+ # Get the statistics from an IoT hub
478
+ #
479
+ # Get the statistics from an IoT hub.
480
+ #
481
+ # @param resource_group_name [String] The name of the resource group that
482
+ # contains the IoT hub.
483
+ # @param resource_name [String] The name of the IoT hub.
484
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
485
+ # will be added to the HTTP request.
486
+ #
487
+ # @return [RegistryStatistics] operation results.
488
+ #
489
+ def get_stats(resource_group_name, resource_name, custom_headers:nil)
490
+ response = get_stats_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
491
+ response.body unless response.nil?
492
+ end
493
+
494
+ #
495
+ # Get the statistics from an IoT hub
496
+ #
497
+ # Get the statistics from an IoT hub.
498
+ #
499
+ # @param resource_group_name [String] The name of the resource group that
500
+ # contains the IoT hub.
501
+ # @param resource_name [String] The name of the IoT hub.
502
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
503
+ # will be added to the HTTP request.
504
+ #
505
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
506
+ #
507
+ def get_stats_with_http_info(resource_group_name, resource_name, custom_headers:nil)
508
+ get_stats_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
509
+ end
510
+
511
+ #
512
+ # Get the statistics from an IoT hub
513
+ #
514
+ # Get the statistics from an IoT hub.
515
+ #
516
+ # @param resource_group_name [String] The name of the resource group that
517
+ # contains the IoT hub.
518
+ # @param resource_name [String] The name of the IoT hub.
519
+ # @param [Hash{String => String}] A hash of custom headers that will be added
520
+ # to the HTTP request.
521
+ #
522
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
523
+ #
524
+ def get_stats_async(resource_group_name, resource_name, custom_headers:nil)
525
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
526
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
527
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
528
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
529
+
530
+
531
+ request_headers = {}
532
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
533
+
534
+ # Set Headers
535
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
536
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
537
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'
538
+
539
+ request_url = @base_url || @client.base_url
540
+
541
+ options = {
542
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
543
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
544
+ query_params: {'api-version' => @client.api_version},
545
+ headers: request_headers.merge(custom_headers || {}),
546
+ base_url: request_url
547
+ }
548
+ promise = @client.make_request_async(:get, path_template, options)
549
+
550
+ promise = promise.then do |result|
551
+ http_response = result.response
552
+ status_code = http_response.status
553
+ response_content = http_response.body
554
+ unless status_code == 200
555
+ error_model = JSON.load(response_content)
556
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
557
+ end
558
+
559
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
560
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
561
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
562
+ # Deserialize Response
563
+ if status_code == 200
564
+ begin
565
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
566
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::RegistryStatistics.mapper()
567
+ result.body = @client.deserialize(result_mapper, parsed_response)
568
+ rescue Exception => e
569
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
570
+ end
571
+ end
572
+
573
+ result
574
+ end
575
+
576
+ promise.execute
577
+ end
578
+
579
+ #
580
+ # Get the list of valid SKUs for an IoT hub
581
+ #
582
+ # Get the list of valid SKUs for an IoT hub.
583
+ #
584
+ # @param resource_group_name [String] The name of the resource group that
585
+ # contains the IoT hub.
586
+ # @param resource_name [String] The name of the IoT hub.
587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
588
+ # will be added to the HTTP request.
589
+ #
590
+ # @return [Array<IotHubSkuDescription>] operation results.
591
+ #
592
+ def get_valid_skus(resource_group_name, resource_name, custom_headers:nil)
593
+ first_page = get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
594
+ first_page.get_all_items
595
+ end
596
+
597
+ #
598
+ # Get the list of valid SKUs for an IoT hub
599
+ #
600
+ # Get the list of valid SKUs for an IoT hub.
601
+ #
602
+ # @param resource_group_name [String] The name of the resource group that
603
+ # contains the IoT hub.
604
+ # @param resource_name [String] The name of the IoT hub.
605
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
606
+ # will be added to the HTTP request.
607
+ #
608
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
609
+ #
610
+ def get_valid_skus_with_http_info(resource_group_name, resource_name, custom_headers:nil)
611
+ get_valid_skus_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
612
+ end
613
+
614
+ #
615
+ # Get the list of valid SKUs for an IoT hub
616
+ #
617
+ # Get the list of valid SKUs for an IoT hub.
618
+ #
619
+ # @param resource_group_name [String] The name of the resource group that
620
+ # contains the IoT hub.
621
+ # @param resource_name [String] The name of the IoT hub.
622
+ # @param [Hash{String => String}] A hash of custom headers that will be added
623
+ # to the HTTP request.
624
+ #
625
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
626
+ #
627
+ def get_valid_skus_async(resource_group_name, resource_name, custom_headers:nil)
628
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
629
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
630
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
631
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
632
+
633
+
634
+ request_headers = {}
635
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
636
+
637
+ # Set Headers
638
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
639
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
640
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'
641
+
642
+ request_url = @base_url || @client.base_url
643
+
644
+ options = {
645
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
646
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
647
+ query_params: {'api-version' => @client.api_version},
648
+ headers: request_headers.merge(custom_headers || {}),
649
+ base_url: request_url
650
+ }
651
+ promise = @client.make_request_async(:get, path_template, options)
652
+
653
+ promise = promise.then do |result|
654
+ http_response = result.response
655
+ status_code = http_response.status
656
+ response_content = http_response.body
657
+ unless status_code == 200
658
+ error_model = JSON.load(response_content)
659
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
660
+ end
661
+
662
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
663
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
664
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
665
+ # Deserialize Response
666
+ if status_code == 200
667
+ begin
668
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
669
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubSkuDescriptionListResult.mapper()
670
+ result.body = @client.deserialize(result_mapper, parsed_response)
671
+ rescue Exception => e
672
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
673
+ end
674
+ end
675
+
676
+ result
677
+ end
678
+
679
+ promise.execute
680
+ end
681
+
682
+ #
683
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
684
+ # endpoint in an IoT hub
685
+ #
686
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
687
+ # endpoint in an IoT hub.
688
+ #
689
+ # @param resource_group_name [String] The name of the resource group that
690
+ # contains the IoT hub.
691
+ # @param resource_name [String] The name of the IoT hub.
692
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
693
+ # endpoint.
694
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
695
+ # will be added to the HTTP request.
696
+ #
697
+ # @return [Array<EventHubConsumerGroupInfo>] operation results.
698
+ #
699
+ def list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
700
+ first_page = list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers)
701
+ first_page.get_all_items
702
+ end
703
+
704
+ #
705
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
706
+ # endpoint in an IoT hub
707
+ #
708
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
709
+ # endpoint in an IoT hub.
710
+ #
711
+ # @param resource_group_name [String] The name of the resource group that
712
+ # contains the IoT hub.
713
+ # @param resource_name [String] The name of the IoT hub.
714
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
715
+ # endpoint.
716
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
717
+ # will be added to the HTTP request.
718
+ #
719
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
720
+ #
721
+ def list_event_hub_consumer_groups_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
722
+ list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers).value!
723
+ end
724
+
725
+ #
726
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
727
+ # endpoint in an IoT hub
728
+ #
729
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
730
+ # endpoint in an IoT hub.
731
+ #
732
+ # @param resource_group_name [String] The name of the resource group that
733
+ # contains the IoT hub.
734
+ # @param resource_name [String] The name of the IoT hub.
735
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
736
+ # endpoint.
737
+ # @param [Hash{String => String}] A hash of custom headers that will be added
738
+ # to the HTTP request.
739
+ #
740
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
741
+ #
742
+ def list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
743
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
744
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
745
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
746
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
747
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
748
+
749
+
750
+ request_headers = {}
751
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
752
+
753
+ # Set Headers
754
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
755
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
756
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'
757
+
758
+ request_url = @base_url || @client.base_url
759
+
760
+ options = {
761
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
762
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name},
763
+ query_params: {'api-version' => @client.api_version},
764
+ headers: request_headers.merge(custom_headers || {}),
765
+ base_url: request_url
766
+ }
767
+ promise = @client.make_request_async(:get, path_template, options)
768
+
769
+ promise = promise.then do |result|
770
+ http_response = result.response
771
+ status_code = http_response.status
772
+ response_content = http_response.body
773
+ unless status_code == 200
774
+ error_model = JSON.load(response_content)
775
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
776
+ end
777
+
778
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
779
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
780
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
781
+ # Deserialize Response
782
+ if status_code == 200
783
+ begin
784
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
785
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::EventHubConsumerGroupsListResult.mapper()
786
+ result.body = @client.deserialize(result_mapper, parsed_response)
787
+ rescue Exception => e
788
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
789
+ end
790
+ end
791
+
792
+ result
793
+ end
794
+
795
+ promise.execute
796
+ end
797
+
798
+ #
799
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
800
+ # for an IoT hub
801
+ #
802
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
803
+ # for an IoT hub.
804
+ #
805
+ # @param resource_group_name [String] The name of the resource group that
806
+ # contains the IoT hub.
807
+ # @param resource_name [String] The name of the IoT hub.
808
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
809
+ # endpoint in the IoT hub.
810
+ # @param name [String] The name of the consumer group to retrieve.
811
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
812
+ # will be added to the HTTP request.
813
+ #
814
+ # @return [EventHubConsumerGroupInfo] operation results.
815
+ #
816
+ def get_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
817
+ response = get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
818
+ response.body unless response.nil?
819
+ end
820
+
821
+ #
822
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
823
+ # for an IoT hub
824
+ #
825
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
826
+ # for an IoT hub.
827
+ #
828
+ # @param resource_group_name [String] The name of the resource group that
829
+ # contains the IoT hub.
830
+ # @param resource_name [String] The name of the IoT hub.
831
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
832
+ # endpoint in the IoT hub.
833
+ # @param name [String] The name of the consumer group to retrieve.
834
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
835
+ # will be added to the HTTP request.
836
+ #
837
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
838
+ #
839
+ def get_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
840
+ get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
841
+ end
842
+
843
+ #
844
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
845
+ # for an IoT hub
846
+ #
847
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
848
+ # for an IoT hub.
849
+ #
850
+ # @param resource_group_name [String] The name of the resource group that
851
+ # contains the IoT hub.
852
+ # @param resource_name [String] The name of the IoT hub.
853
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
854
+ # endpoint in the IoT hub.
855
+ # @param name [String] The name of the consumer group to retrieve.
856
+ # @param [Hash{String => String}] A hash of custom headers that will be added
857
+ # to the HTTP request.
858
+ #
859
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
860
+ #
861
+ def get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
862
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
863
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
864
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
865
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
866
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
867
+ fail ArgumentError, 'name is nil' if name.nil?
868
+
869
+
870
+ request_headers = {}
871
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
872
+
873
+ # Set Headers
874
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
875
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
876
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
877
+
878
+ request_url = @base_url || @client.base_url
879
+
880
+ options = {
881
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
882
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
883
+ query_params: {'api-version' => @client.api_version},
884
+ headers: request_headers.merge(custom_headers || {}),
885
+ base_url: request_url
886
+ }
887
+ promise = @client.make_request_async(:get, path_template, options)
888
+
889
+ promise = promise.then do |result|
890
+ http_response = result.response
891
+ status_code = http_response.status
892
+ response_content = http_response.body
893
+ unless status_code == 200
894
+ error_model = JSON.load(response_content)
895
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
896
+ end
897
+
898
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
899
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
900
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
901
+ # Deserialize Response
902
+ if status_code == 200
903
+ begin
904
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
905
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::EventHubConsumerGroupInfo.mapper()
906
+ result.body = @client.deserialize(result_mapper, parsed_response)
907
+ rescue Exception => e
908
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
909
+ end
910
+ end
911
+
912
+ result
913
+ end
914
+
915
+ promise.execute
916
+ end
917
+
918
+ #
919
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub
920
+ #
921
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.
922
+ #
923
+ # @param resource_group_name [String] The name of the resource group that
924
+ # contains the IoT hub.
925
+ # @param resource_name [String] The name of the IoT hub.
926
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
927
+ # endpoint in the IoT hub.
928
+ # @param name [String] The name of the consumer group to add.
929
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
930
+ # will be added to the HTTP request.
931
+ #
932
+ # @return [EventHubConsumerGroupInfo] operation results.
933
+ #
934
+ def create_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
935
+ response = create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
936
+ response.body unless response.nil?
937
+ end
938
+
939
+ #
940
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub
941
+ #
942
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.
943
+ #
944
+ # @param resource_group_name [String] The name of the resource group that
945
+ # contains the IoT hub.
946
+ # @param resource_name [String] The name of the IoT hub.
947
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
948
+ # endpoint in the IoT hub.
949
+ # @param name [String] The name of the consumer group to add.
950
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
951
+ # will be added to the HTTP request.
952
+ #
953
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
954
+ #
955
+ def create_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
956
+ create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
957
+ end
958
+
959
+ #
960
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub
961
+ #
962
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.
963
+ #
964
+ # @param resource_group_name [String] The name of the resource group that
965
+ # contains the IoT hub.
966
+ # @param resource_name [String] The name of the IoT hub.
967
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
968
+ # endpoint in the IoT hub.
969
+ # @param name [String] The name of the consumer group to add.
970
+ # @param [Hash{String => String}] A hash of custom headers that will be added
971
+ # to the HTTP request.
972
+ #
973
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
974
+ #
975
+ def create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
976
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
977
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
978
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
979
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
980
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
981
+ fail ArgumentError, 'name is nil' if name.nil?
982
+
983
+
984
+ request_headers = {}
985
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
986
+
987
+ # Set Headers
988
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
989
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
990
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
991
+
992
+ request_url = @base_url || @client.base_url
993
+
994
+ options = {
995
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
996
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
997
+ query_params: {'api-version' => @client.api_version},
998
+ headers: request_headers.merge(custom_headers || {}),
999
+ base_url: request_url
1000
+ }
1001
+ promise = @client.make_request_async(:put, path_template, options)
1002
+
1003
+ promise = promise.then do |result|
1004
+ http_response = result.response
1005
+ status_code = http_response.status
1006
+ response_content = http_response.body
1007
+ unless status_code == 200
1008
+ error_model = JSON.load(response_content)
1009
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1010
+ end
1011
+
1012
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1013
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1014
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1015
+ # Deserialize Response
1016
+ if status_code == 200
1017
+ begin
1018
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1019
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::EventHubConsumerGroupInfo.mapper()
1020
+ result.body = @client.deserialize(result_mapper, parsed_response)
1021
+ rescue Exception => e
1022
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1023
+ end
1024
+ end
1025
+
1026
+ result
1027
+ end
1028
+
1029
+ promise.execute
1030
+ end
1031
+
1032
+ #
1033
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub
1034
+ #
1035
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.
1036
+ #
1037
+ # @param resource_group_name [String] The name of the resource group that
1038
+ # contains the IoT hub.
1039
+ # @param resource_name [String] The name of the IoT hub.
1040
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
1041
+ # endpoint in the IoT hub.
1042
+ # @param name [String] The name of the consumer group to delete.
1043
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1044
+ # will be added to the HTTP request.
1045
+ #
1046
+ #
1047
+ def delete_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
1048
+ response = delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
1049
+ nil
1050
+ end
1051
+
1052
+ #
1053
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub
1054
+ #
1055
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.
1056
+ #
1057
+ # @param resource_group_name [String] The name of the resource group that
1058
+ # contains the IoT hub.
1059
+ # @param resource_name [String] The name of the IoT hub.
1060
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
1061
+ # endpoint in the IoT hub.
1062
+ # @param name [String] The name of the consumer group to delete.
1063
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1064
+ # will be added to the HTTP request.
1065
+ #
1066
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1067
+ #
1068
+ def delete_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
1069
+ delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
1070
+ end
1071
+
1072
+ #
1073
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub
1074
+ #
1075
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.
1076
+ #
1077
+ # @param resource_group_name [String] The name of the resource group that
1078
+ # contains the IoT hub.
1079
+ # @param resource_name [String] The name of the IoT hub.
1080
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
1081
+ # endpoint in the IoT hub.
1082
+ # @param name [String] The name of the consumer group to delete.
1083
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1084
+ # to the HTTP request.
1085
+ #
1086
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1087
+ #
1088
+ def delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
1089
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1090
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1091
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1092
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1093
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
1094
+ fail ArgumentError, 'name is nil' if name.nil?
1095
+
1096
+
1097
+ request_headers = {}
1098
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1099
+
1100
+ # Set Headers
1101
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1102
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1103
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
1104
+
1105
+ request_url = @base_url || @client.base_url
1106
+
1107
+ options = {
1108
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1109
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
1110
+ query_params: {'api-version' => @client.api_version},
1111
+ headers: request_headers.merge(custom_headers || {}),
1112
+ base_url: request_url
1113
+ }
1114
+ promise = @client.make_request_async(:delete, path_template, options)
1115
+
1116
+ promise = promise.then do |result|
1117
+ http_response = result.response
1118
+ status_code = http_response.status
1119
+ response_content = http_response.body
1120
+ unless status_code == 200
1121
+ error_model = JSON.load(response_content)
1122
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1123
+ end
1124
+
1125
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1126
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1127
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1128
+
1129
+ result
1130
+ end
1131
+
1132
+ promise.execute
1133
+ end
1134
+
1135
+ #
1136
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1137
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
1138
+ #
1139
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1140
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1141
+ #
1142
+ # @param resource_group_name [String] The name of the resource group that
1143
+ # contains the IoT hub.
1144
+ # @param resource_name [String] The name of the IoT hub.
1145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1146
+ # will be added to the HTTP request.
1147
+ #
1148
+ # @return [Array<JobResponse>] operation results.
1149
+ #
1150
+ def list_jobs(resource_group_name, resource_name, custom_headers:nil)
1151
+ first_page = list_jobs_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
1152
+ first_page.get_all_items
1153
+ end
1154
+
1155
+ #
1156
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1157
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
1158
+ #
1159
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1160
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1161
+ #
1162
+ # @param resource_group_name [String] The name of the resource group that
1163
+ # contains the IoT hub.
1164
+ # @param resource_name [String] The name of the IoT hub.
1165
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1166
+ # will be added to the HTTP request.
1167
+ #
1168
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1169
+ #
1170
+ def list_jobs_with_http_info(resource_group_name, resource_name, custom_headers:nil)
1171
+ list_jobs_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
1172
+ end
1173
+
1174
+ #
1175
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1176
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
1177
+ #
1178
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1179
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1180
+ #
1181
+ # @param resource_group_name [String] The name of the resource group that
1182
+ # contains the IoT hub.
1183
+ # @param resource_name [String] The name of the IoT hub.
1184
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1185
+ # to the HTTP request.
1186
+ #
1187
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1188
+ #
1189
+ def list_jobs_async(resource_group_name, resource_name, custom_headers:nil)
1190
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1191
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1192
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1193
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1194
+
1195
+
1196
+ request_headers = {}
1197
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1198
+
1199
+ # Set Headers
1200
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1201
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1202
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'
1203
+
1204
+ request_url = @base_url || @client.base_url
1205
+
1206
+ options = {
1207
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1208
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1209
+ query_params: {'api-version' => @client.api_version},
1210
+ headers: request_headers.merge(custom_headers || {}),
1211
+ base_url: request_url
1212
+ }
1213
+ promise = @client.make_request_async(:get, path_template, options)
1214
+
1215
+ promise = promise.then do |result|
1216
+ http_response = result.response
1217
+ status_code = http_response.status
1218
+ response_content = http_response.body
1219
+ unless status_code == 200
1220
+ error_model = JSON.load(response_content)
1221
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1222
+ end
1223
+
1224
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1225
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1226
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1227
+ # Deserialize Response
1228
+ if status_code == 200
1229
+ begin
1230
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1231
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::JobResponseListResult.mapper()
1232
+ result.body = @client.deserialize(result_mapper, parsed_response)
1233
+ rescue Exception => e
1234
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1235
+ end
1236
+ end
1237
+
1238
+ result
1239
+ end
1240
+
1241
+ promise.execute
1242
+ end
1243
+
1244
+ #
1245
+ # Get the details of a job from an IoT hub. For more information, see:
1246
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
1247
+ #
1248
+ # Get the details of a job from an IoT hub. For more information, see:
1249
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1250
+ #
1251
+ # @param resource_group_name [String] The name of the resource group that
1252
+ # contains the IoT hub.
1253
+ # @param resource_name [String] The name of the IoT hub.
1254
+ # @param job_id [String] The job identifier.
1255
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1256
+ # will be added to the HTTP request.
1257
+ #
1258
+ # @return [JobResponse] operation results.
1259
+ #
1260
+ def get_job(resource_group_name, resource_name, job_id, custom_headers:nil)
1261
+ response = get_job_async(resource_group_name, resource_name, job_id, custom_headers:custom_headers).value!
1262
+ response.body unless response.nil?
1263
+ end
1264
+
1265
+ #
1266
+ # Get the details of a job from an IoT hub. For more information, see:
1267
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
1268
+ #
1269
+ # Get the details of a job from an IoT hub. For more information, see:
1270
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1271
+ #
1272
+ # @param resource_group_name [String] The name of the resource group that
1273
+ # contains the IoT hub.
1274
+ # @param resource_name [String] The name of the IoT hub.
1275
+ # @param job_id [String] The job identifier.
1276
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1277
+ # will be added to the HTTP request.
1278
+ #
1279
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1280
+ #
1281
+ def get_job_with_http_info(resource_group_name, resource_name, job_id, custom_headers:nil)
1282
+ get_job_async(resource_group_name, resource_name, job_id, custom_headers:custom_headers).value!
1283
+ end
1284
+
1285
+ #
1286
+ # Get the details of a job from an IoT hub. For more information, see:
1287
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
1288
+ #
1289
+ # Get the details of a job from an IoT hub. For more information, see:
1290
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1291
+ #
1292
+ # @param resource_group_name [String] The name of the resource group that
1293
+ # contains the IoT hub.
1294
+ # @param resource_name [String] The name of the IoT hub.
1295
+ # @param job_id [String] The job identifier.
1296
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1297
+ # to the HTTP request.
1298
+ #
1299
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1300
+ #
1301
+ def get_job_async(resource_group_name, resource_name, job_id, custom_headers:nil)
1302
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1303
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1304
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1305
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1306
+ fail ArgumentError, 'job_id is nil' if job_id.nil?
1307
+
1308
+
1309
+ request_headers = {}
1310
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1311
+
1312
+ # Set Headers
1313
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1314
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1315
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'
1316
+
1317
+ request_url = @base_url || @client.base_url
1318
+
1319
+ options = {
1320
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1321
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'jobId' => job_id},
1322
+ query_params: {'api-version' => @client.api_version},
1323
+ headers: request_headers.merge(custom_headers || {}),
1324
+ base_url: request_url
1325
+ }
1326
+ promise = @client.make_request_async(:get, path_template, options)
1327
+
1328
+ promise = promise.then do |result|
1329
+ http_response = result.response
1330
+ status_code = http_response.status
1331
+ response_content = http_response.body
1332
+ unless status_code == 200
1333
+ error_model = JSON.load(response_content)
1334
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1335
+ end
1336
+
1337
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1338
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1339
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1340
+ # Deserialize Response
1341
+ if status_code == 200
1342
+ begin
1343
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1344
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::JobResponse.mapper()
1345
+ result.body = @client.deserialize(result_mapper, parsed_response)
1346
+ rescue Exception => e
1347
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1348
+ end
1349
+ end
1350
+
1351
+ result
1352
+ end
1353
+
1354
+ promise.execute
1355
+ end
1356
+
1357
+ #
1358
+ # Get the quota metrics for an IoT hub
1359
+ #
1360
+ # Get the quota metrics for an IoT hub.
1361
+ #
1362
+ # @param resource_group_name [String] The name of the resource group that
1363
+ # contains the IoT hub.
1364
+ # @param resource_name [String] The name of the IoT hub.
1365
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1366
+ # will be added to the HTTP request.
1367
+ #
1368
+ # @return [Array<IotHubQuotaMetricInfo>] operation results.
1369
+ #
1370
+ def get_quota_metrics(resource_group_name, resource_name, custom_headers:nil)
1371
+ first_page = get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
1372
+ first_page.get_all_items
1373
+ end
1374
+
1375
+ #
1376
+ # Get the quota metrics for an IoT hub
1377
+ #
1378
+ # Get the quota metrics for an IoT hub.
1379
+ #
1380
+ # @param resource_group_name [String] The name of the resource group that
1381
+ # contains the IoT hub.
1382
+ # @param resource_name [String] The name of the IoT hub.
1383
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1384
+ # will be added to the HTTP request.
1385
+ #
1386
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1387
+ #
1388
+ def get_quota_metrics_with_http_info(resource_group_name, resource_name, custom_headers:nil)
1389
+ get_quota_metrics_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
1390
+ end
1391
+
1392
+ #
1393
+ # Get the quota metrics for an IoT hub
1394
+ #
1395
+ # Get the quota metrics for an IoT hub.
1396
+ #
1397
+ # @param resource_group_name [String] The name of the resource group that
1398
+ # contains the IoT hub.
1399
+ # @param resource_name [String] The name of the IoT hub.
1400
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1401
+ # to the HTTP request.
1402
+ #
1403
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1404
+ #
1405
+ def get_quota_metrics_async(resource_group_name, resource_name, custom_headers:nil)
1406
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1407
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1408
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1409
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1410
+
1411
+
1412
+ request_headers = {}
1413
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1414
+
1415
+ # Set Headers
1416
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1417
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1418
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'
1419
+
1420
+ request_url = @base_url || @client.base_url
1421
+
1422
+ options = {
1423
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1424
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1425
+ query_params: {'api-version' => @client.api_version},
1426
+ headers: request_headers.merge(custom_headers || {}),
1427
+ base_url: request_url
1428
+ }
1429
+ promise = @client.make_request_async(:get, path_template, options)
1430
+
1431
+ promise = promise.then do |result|
1432
+ http_response = result.response
1433
+ status_code = http_response.status
1434
+ response_content = http_response.body
1435
+ unless status_code == 200
1436
+ error_model = JSON.load(response_content)
1437
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1438
+ end
1439
+
1440
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1441
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1442
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1443
+ # Deserialize Response
1444
+ if status_code == 200
1445
+ begin
1446
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1447
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubQuotaMetricInfoListResult.mapper()
1448
+ result.body = @client.deserialize(result_mapper, parsed_response)
1449
+ rescue Exception => e
1450
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1451
+ end
1452
+ end
1453
+
1454
+ result
1455
+ end
1456
+
1457
+ promise.execute
1458
+ end
1459
+
1460
+ #
1461
+ # Get the health for routing endpoints
1462
+ #
1463
+ # Get the health for routing endpoints.
1464
+ #
1465
+ # @param resource_group_name [String]
1466
+ # @param iot_hub_name [String]
1467
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1468
+ # will be added to the HTTP request.
1469
+ #
1470
+ # @return [Array<EndpointHealthData>] operation results.
1471
+ #
1472
+ def get_endpoint_health(resource_group_name, iot_hub_name, custom_headers:nil)
1473
+ first_page = get_endpoint_health_as_lazy(resource_group_name, iot_hub_name, custom_headers:custom_headers)
1474
+ first_page.get_all_items
1475
+ end
1476
+
1477
+ #
1478
+ # Get the health for routing endpoints
1479
+ #
1480
+ # Get the health for routing endpoints.
1481
+ #
1482
+ # @param resource_group_name [String]
1483
+ # @param iot_hub_name [String]
1484
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1485
+ # will be added to the HTTP request.
1486
+ #
1487
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1488
+ #
1489
+ def get_endpoint_health_with_http_info(resource_group_name, iot_hub_name, custom_headers:nil)
1490
+ get_endpoint_health_async(resource_group_name, iot_hub_name, custom_headers:custom_headers).value!
1491
+ end
1492
+
1493
+ #
1494
+ # Get the health for routing endpoints
1495
+ #
1496
+ # Get the health for routing endpoints.
1497
+ #
1498
+ # @param resource_group_name [String]
1499
+ # @param iot_hub_name [String]
1500
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1501
+ # to the HTTP request.
1502
+ #
1503
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1504
+ #
1505
+ def get_endpoint_health_async(resource_group_name, iot_hub_name, custom_headers:nil)
1506
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1507
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1508
+ fail ArgumentError, 'iot_hub_name is nil' if iot_hub_name.nil?
1509
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1510
+
1511
+
1512
+ request_headers = {}
1513
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1514
+
1515
+ # Set Headers
1516
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1517
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1518
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth'
1519
+
1520
+ request_url = @base_url || @client.base_url
1521
+
1522
+ options = {
1523
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1524
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'iotHubName' => iot_hub_name},
1525
+ query_params: {'api-version' => @client.api_version},
1526
+ headers: request_headers.merge(custom_headers || {}),
1527
+ base_url: request_url
1528
+ }
1529
+ promise = @client.make_request_async(:get, path_template, options)
1530
+
1531
+ promise = promise.then do |result|
1532
+ http_response = result.response
1533
+ status_code = http_response.status
1534
+ response_content = http_response.body
1535
+ unless status_code == 200
1536
+ error_model = JSON.load(response_content)
1537
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1538
+ end
1539
+
1540
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1541
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1542
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1543
+ # Deserialize Response
1544
+ if status_code == 200
1545
+ begin
1546
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1547
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::EndpointHealthDataListResult.mapper()
1548
+ result.body = @client.deserialize(result_mapper, parsed_response)
1549
+ rescue Exception => e
1550
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1551
+ end
1552
+ end
1553
+
1554
+ result
1555
+ end
1556
+
1557
+ promise.execute
1558
+ end
1559
+
1560
+ #
1561
+ # Check if an IoT hub name is available
1562
+ #
1563
+ # Check if an IoT hub name is available.
1564
+ #
1565
+ # @param operation_inputs [OperationInputs] Set the name parameter in the
1566
+ # OperationInputs structure to the name of the IoT hub to check.
1567
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1568
+ # will be added to the HTTP request.
1569
+ #
1570
+ # @return [IotHubNameAvailabilityInfo] operation results.
1571
+ #
1572
+ def check_name_availability(operation_inputs, custom_headers:nil)
1573
+ response = check_name_availability_async(operation_inputs, custom_headers:custom_headers).value!
1574
+ response.body unless response.nil?
1575
+ end
1576
+
1577
+ #
1578
+ # Check if an IoT hub name is available
1579
+ #
1580
+ # Check if an IoT hub name is available.
1581
+ #
1582
+ # @param operation_inputs [OperationInputs] Set the name parameter in the
1583
+ # OperationInputs structure to the name of the IoT hub to check.
1584
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1585
+ # will be added to the HTTP request.
1586
+ #
1587
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1588
+ #
1589
+ def check_name_availability_with_http_info(operation_inputs, custom_headers:nil)
1590
+ check_name_availability_async(operation_inputs, custom_headers:custom_headers).value!
1591
+ end
1592
+
1593
+ #
1594
+ # Check if an IoT hub name is available
1595
+ #
1596
+ # Check if an IoT hub name is available.
1597
+ #
1598
+ # @param operation_inputs [OperationInputs] Set the name parameter in the
1599
+ # OperationInputs structure to the name of the IoT hub to check.
1600
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1601
+ # to the HTTP request.
1602
+ #
1603
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1604
+ #
1605
+ def check_name_availability_async(operation_inputs, custom_headers:nil)
1606
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1607
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1608
+ fail ArgumentError, 'operation_inputs is nil' if operation_inputs.nil?
1609
+
1610
+
1611
+ request_headers = {}
1612
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1613
+
1614
+ # Set Headers
1615
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1616
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1617
+
1618
+ # Serialize Request
1619
+ request_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::OperationInputs.mapper()
1620
+ request_content = @client.serialize(request_mapper, operation_inputs)
1621
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1622
+
1623
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'
1624
+
1625
+ request_url = @base_url || @client.base_url
1626
+
1627
+ options = {
1628
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1629
+ path_params: {'subscriptionId' => @client.subscription_id},
1630
+ query_params: {'api-version' => @client.api_version},
1631
+ body: request_content,
1632
+ headers: request_headers.merge(custom_headers || {}),
1633
+ base_url: request_url
1634
+ }
1635
+ promise = @client.make_request_async(:post, path_template, options)
1636
+
1637
+ promise = promise.then do |result|
1638
+ http_response = result.response
1639
+ status_code = http_response.status
1640
+ response_content = http_response.body
1641
+ unless status_code == 200
1642
+ error_model = JSON.load(response_content)
1643
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1644
+ end
1645
+
1646
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1647
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1648
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1649
+ # Deserialize Response
1650
+ if status_code == 200
1651
+ begin
1652
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1653
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubNameAvailabilityInfo.mapper()
1654
+ result.body = @client.deserialize(result_mapper, parsed_response)
1655
+ rescue Exception => e
1656
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1657
+ end
1658
+ end
1659
+
1660
+ result
1661
+ end
1662
+
1663
+ promise.execute
1664
+ end
1665
+
1666
+ #
1667
+ # Test all routes
1668
+ #
1669
+ # Test all routes configured in this Iot Hub
1670
+ #
1671
+ # @param input [TestAllRoutesInput] Input for testing all routes
1672
+ # @param iot_hub_name [String] IotHub to be tested
1673
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
1674
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1675
+ # will be added to the HTTP request.
1676
+ #
1677
+ # @return [TestAllRoutesResult] operation results.
1678
+ #
1679
+ def test_all_routes(input, iot_hub_name, resource_group_name, custom_headers:nil)
1680
+ response = test_all_routes_async(input, iot_hub_name, resource_group_name, custom_headers:custom_headers).value!
1681
+ response.body unless response.nil?
1682
+ end
1683
+
1684
+ #
1685
+ # Test all routes
1686
+ #
1687
+ # Test all routes configured in this Iot Hub
1688
+ #
1689
+ # @param input [TestAllRoutesInput] Input for testing all routes
1690
+ # @param iot_hub_name [String] IotHub to be tested
1691
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
1692
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1693
+ # will be added to the HTTP request.
1694
+ #
1695
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1696
+ #
1697
+ def test_all_routes_with_http_info(input, iot_hub_name, resource_group_name, custom_headers:nil)
1698
+ test_all_routes_async(input, iot_hub_name, resource_group_name, custom_headers:custom_headers).value!
1699
+ end
1700
+
1701
+ #
1702
+ # Test all routes
1703
+ #
1704
+ # Test all routes configured in this Iot Hub
1705
+ #
1706
+ # @param input [TestAllRoutesInput] Input for testing all routes
1707
+ # @param iot_hub_name [String] IotHub to be tested
1708
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
1709
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1710
+ # to the HTTP request.
1711
+ #
1712
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1713
+ #
1714
+ def test_all_routes_async(input, iot_hub_name, resource_group_name, custom_headers:nil)
1715
+ fail ArgumentError, 'input is nil' if input.nil?
1716
+ fail ArgumentError, 'iot_hub_name is nil' if iot_hub_name.nil?
1717
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1718
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1719
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1720
+
1721
+
1722
+ request_headers = {}
1723
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1724
+
1725
+ # Set Headers
1726
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1727
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1728
+
1729
+ # Serialize Request
1730
+ request_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::TestAllRoutesInput.mapper()
1731
+ request_content = @client.serialize(request_mapper, input)
1732
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1733
+
1734
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'
1735
+
1736
+ request_url = @base_url || @client.base_url
1737
+
1738
+ options = {
1739
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1740
+ path_params: {'iotHubName' => iot_hub_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
1741
+ query_params: {'api-version' => @client.api_version},
1742
+ body: request_content,
1743
+ headers: request_headers.merge(custom_headers || {}),
1744
+ base_url: request_url
1745
+ }
1746
+ promise = @client.make_request_async(:post, path_template, options)
1747
+
1748
+ promise = promise.then do |result|
1749
+ http_response = result.response
1750
+ status_code = http_response.status
1751
+ response_content = http_response.body
1752
+ unless status_code == 200
1753
+ error_model = JSON.load(response_content)
1754
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1755
+ end
1756
+
1757
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1758
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1759
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1760
+ # Deserialize Response
1761
+ if status_code == 200
1762
+ begin
1763
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1764
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::TestAllRoutesResult.mapper()
1765
+ result.body = @client.deserialize(result_mapper, parsed_response)
1766
+ rescue Exception => e
1767
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1768
+ end
1769
+ end
1770
+
1771
+ result
1772
+ end
1773
+
1774
+ promise.execute
1775
+ end
1776
+
1777
+ #
1778
+ # Test the new route
1779
+ #
1780
+ # Test the new route for this Iot Hub
1781
+ #
1782
+ # @param input [TestRouteInput] Route that needs to be tested
1783
+ # @param iot_hub_name [String] IotHub to be tested
1784
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
1785
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1786
+ # will be added to the HTTP request.
1787
+ #
1788
+ # @return [TestRouteResult] operation results.
1789
+ #
1790
+ def test_route(input, iot_hub_name, resource_group_name, custom_headers:nil)
1791
+ response = test_route_async(input, iot_hub_name, resource_group_name, custom_headers:custom_headers).value!
1792
+ response.body unless response.nil?
1793
+ end
1794
+
1795
+ #
1796
+ # Test the new route
1797
+ #
1798
+ # Test the new route for this Iot Hub
1799
+ #
1800
+ # @param input [TestRouteInput] Route that needs to be tested
1801
+ # @param iot_hub_name [String] IotHub to be tested
1802
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
1803
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1804
+ # will be added to the HTTP request.
1805
+ #
1806
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1807
+ #
1808
+ def test_route_with_http_info(input, iot_hub_name, resource_group_name, custom_headers:nil)
1809
+ test_route_async(input, iot_hub_name, resource_group_name, custom_headers:custom_headers).value!
1810
+ end
1811
+
1812
+ #
1813
+ # Test the new route
1814
+ #
1815
+ # Test the new route for this Iot Hub
1816
+ #
1817
+ # @param input [TestRouteInput] Route that needs to be tested
1818
+ # @param iot_hub_name [String] IotHub to be tested
1819
+ # @param resource_group_name [String] resource group which Iot Hub belongs to
1820
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1821
+ # to the HTTP request.
1822
+ #
1823
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1824
+ #
1825
+ def test_route_async(input, iot_hub_name, resource_group_name, custom_headers:nil)
1826
+ fail ArgumentError, 'input is nil' if input.nil?
1827
+ fail ArgumentError, 'iot_hub_name is nil' if iot_hub_name.nil?
1828
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1829
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1830
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1831
+
1832
+
1833
+ request_headers = {}
1834
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1835
+
1836
+ # Set Headers
1837
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1838
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1839
+
1840
+ # Serialize Request
1841
+ request_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::TestRouteInput.mapper()
1842
+ request_content = @client.serialize(request_mapper, input)
1843
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1844
+
1845
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'
1846
+
1847
+ request_url = @base_url || @client.base_url
1848
+
1849
+ options = {
1850
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1851
+ path_params: {'iotHubName' => iot_hub_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
1852
+ query_params: {'api-version' => @client.api_version},
1853
+ body: request_content,
1854
+ headers: request_headers.merge(custom_headers || {}),
1855
+ base_url: request_url
1856
+ }
1857
+ promise = @client.make_request_async(:post, path_template, options)
1858
+
1859
+ promise = promise.then do |result|
1860
+ http_response = result.response
1861
+ status_code = http_response.status
1862
+ response_content = http_response.body
1863
+ unless status_code == 200
1864
+ error_model = JSON.load(response_content)
1865
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1866
+ end
1867
+
1868
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1869
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1870
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1871
+ # Deserialize Response
1872
+ if status_code == 200
1873
+ begin
1874
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1875
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::TestRouteResult.mapper()
1876
+ result.body = @client.deserialize(result_mapper, parsed_response)
1877
+ rescue Exception => e
1878
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1879
+ end
1880
+ end
1881
+
1882
+ result
1883
+ end
1884
+
1885
+ promise.execute
1886
+ end
1887
+
1888
+ #
1889
+ # Get the security metadata for an IoT hub. For more information, see:
1890
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
1891
+ #
1892
+ # Get the security metadata for an IoT hub. For more information, see:
1893
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1894
+ #
1895
+ # @param resource_group_name [String] The name of the resource group that
1896
+ # contains the IoT hub.
1897
+ # @param resource_name [String] The name of the IoT hub.
1898
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1899
+ # will be added to the HTTP request.
1900
+ #
1901
+ # @return [Array<SharedAccessSignatureAuthorizationRule>] operation results.
1902
+ #
1903
+ def list_keys(resource_group_name, resource_name, custom_headers:nil)
1904
+ first_page = list_keys_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
1905
+ first_page.get_all_items
1906
+ end
1907
+
1908
+ #
1909
+ # Get the security metadata for an IoT hub. For more information, see:
1910
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
1911
+ #
1912
+ # Get the security metadata for an IoT hub. For more information, see:
1913
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1914
+ #
1915
+ # @param resource_group_name [String] The name of the resource group that
1916
+ # contains the IoT hub.
1917
+ # @param resource_name [String] The name of the IoT hub.
1918
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1919
+ # will be added to the HTTP request.
1920
+ #
1921
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1922
+ #
1923
+ def list_keys_with_http_info(resource_group_name, resource_name, custom_headers:nil)
1924
+ list_keys_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
1925
+ end
1926
+
1927
+ #
1928
+ # Get the security metadata for an IoT hub. For more information, see:
1929
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
1930
+ #
1931
+ # Get the security metadata for an IoT hub. For more information, see:
1932
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1933
+ #
1934
+ # @param resource_group_name [String] The name of the resource group that
1935
+ # contains the IoT hub.
1936
+ # @param resource_name [String] The name of the IoT hub.
1937
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1938
+ # to the HTTP request.
1939
+ #
1940
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1941
+ #
1942
+ def list_keys_async(resource_group_name, resource_name, custom_headers:nil)
1943
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1944
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1945
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1946
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1947
+
1948
+
1949
+ request_headers = {}
1950
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1951
+
1952
+ # Set Headers
1953
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1954
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1955
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'
1956
+
1957
+ request_url = @base_url || @client.base_url
1958
+
1959
+ options = {
1960
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1961
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1962
+ query_params: {'api-version' => @client.api_version},
1963
+ headers: request_headers.merge(custom_headers || {}),
1964
+ base_url: request_url
1965
+ }
1966
+ promise = @client.make_request_async(:post, path_template, options)
1967
+
1968
+ promise = promise.then do |result|
1969
+ http_response = result.response
1970
+ status_code = http_response.status
1971
+ response_content = http_response.body
1972
+ unless status_code == 200
1973
+ error_model = JSON.load(response_content)
1974
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1975
+ end
1976
+
1977
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1978
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1979
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1980
+ # Deserialize Response
1981
+ if status_code == 200
1982
+ begin
1983
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1984
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::SharedAccessSignatureAuthorizationRuleListResult.mapper()
1985
+ result.body = @client.deserialize(result_mapper, parsed_response)
1986
+ rescue Exception => e
1987
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1988
+ end
1989
+ end
1990
+
1991
+ result
1992
+ end
1993
+
1994
+ promise.execute
1995
+ end
1996
+
1997
+ #
1998
+ # Get a shared access policy by name from an IoT hub. For more information,
1999
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
2000
+ #
2001
+ # Get a shared access policy by name from an IoT hub. For more information,
2002
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
2003
+ #
2004
+ # @param resource_group_name [String] The name of the resource group that
2005
+ # contains the IoT hub.
2006
+ # @param resource_name [String] The name of the IoT hub.
2007
+ # @param key_name [String] The name of the shared access policy.
2008
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2009
+ # will be added to the HTTP request.
2010
+ #
2011
+ # @return [SharedAccessSignatureAuthorizationRule] operation results.
2012
+ #
2013
+ def get_keys_for_key_name(resource_group_name, resource_name, key_name, custom_headers:nil)
2014
+ response = get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers:custom_headers).value!
2015
+ response.body unless response.nil?
2016
+ end
2017
+
2018
+ #
2019
+ # Get a shared access policy by name from an IoT hub. For more information,
2020
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
2021
+ #
2022
+ # Get a shared access policy by name from an IoT hub. For more information,
2023
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
2024
+ #
2025
+ # @param resource_group_name [String] The name of the resource group that
2026
+ # contains the IoT hub.
2027
+ # @param resource_name [String] The name of the IoT hub.
2028
+ # @param key_name [String] The name of the shared access policy.
2029
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2030
+ # will be added to the HTTP request.
2031
+ #
2032
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2033
+ #
2034
+ def get_keys_for_key_name_with_http_info(resource_group_name, resource_name, key_name, custom_headers:nil)
2035
+ get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers:custom_headers).value!
2036
+ end
2037
+
2038
+ #
2039
+ # Get a shared access policy by name from an IoT hub. For more information,
2040
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
2041
+ #
2042
+ # Get a shared access policy by name from an IoT hub. For more information,
2043
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
2044
+ #
2045
+ # @param resource_group_name [String] The name of the resource group that
2046
+ # contains the IoT hub.
2047
+ # @param resource_name [String] The name of the IoT hub.
2048
+ # @param key_name [String] The name of the shared access policy.
2049
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2050
+ # to the HTTP request.
2051
+ #
2052
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2053
+ #
2054
+ def get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers:nil)
2055
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2056
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2057
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2058
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2059
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
2060
+
2061
+
2062
+ request_headers = {}
2063
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2064
+
2065
+ # Set Headers
2066
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2067
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2068
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'
2069
+
2070
+ request_url = @base_url || @client.base_url
2071
+
2072
+ options = {
2073
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2074
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'keyName' => key_name},
2075
+ query_params: {'api-version' => @client.api_version},
2076
+ headers: request_headers.merge(custom_headers || {}),
2077
+ base_url: request_url
2078
+ }
2079
+ promise = @client.make_request_async(:post, path_template, options)
2080
+
2081
+ promise = promise.then do |result|
2082
+ http_response = result.response
2083
+ status_code = http_response.status
2084
+ response_content = http_response.body
2085
+ unless status_code == 200
2086
+ error_model = JSON.load(response_content)
2087
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2088
+ end
2089
+
2090
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2091
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2092
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2093
+ # Deserialize Response
2094
+ if status_code == 200
2095
+ begin
2096
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2097
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::SharedAccessSignatureAuthorizationRule.mapper()
2098
+ result.body = @client.deserialize(result_mapper, parsed_response)
2099
+ rescue Exception => e
2100
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2101
+ end
2102
+ end
2103
+
2104
+ result
2105
+ end
2106
+
2107
+ promise.execute
2108
+ end
2109
+
2110
+ #
2111
+ # Exports all the device identities in the IoT hub identity registry to an
2112
+ # Azure Storage blob container. For more information, see:
2113
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities
2114
+ #
2115
+ # Exports all the device identities in the IoT hub identity registry to an
2116
+ # Azure Storage blob container. For more information, see:
2117
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
2118
+ #
2119
+ # @param resource_group_name [String] The name of the resource group that
2120
+ # contains the IoT hub.
2121
+ # @param resource_name [String] The name of the IoT hub.
2122
+ # @param export_devices_parameters [ExportDevicesRequest] The parameters that
2123
+ # specify the export devices operation.
2124
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2125
+ # will be added to the HTTP request.
2126
+ #
2127
+ # @return [JobResponse] operation results.
2128
+ #
2129
+ def export_devices(resource_group_name, resource_name, export_devices_parameters, custom_headers:nil)
2130
+ response = export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers:custom_headers).value!
2131
+ response.body unless response.nil?
2132
+ end
2133
+
2134
+ #
2135
+ # Exports all the device identities in the IoT hub identity registry to an
2136
+ # Azure Storage blob container. For more information, see:
2137
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities
2138
+ #
2139
+ # Exports all the device identities in the IoT hub identity registry to an
2140
+ # Azure Storage blob container. For more information, see:
2141
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
2142
+ #
2143
+ # @param resource_group_name [String] The name of the resource group that
2144
+ # contains the IoT hub.
2145
+ # @param resource_name [String] The name of the IoT hub.
2146
+ # @param export_devices_parameters [ExportDevicesRequest] The parameters that
2147
+ # specify the export devices operation.
2148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2149
+ # will be added to the HTTP request.
2150
+ #
2151
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2152
+ #
2153
+ def export_devices_with_http_info(resource_group_name, resource_name, export_devices_parameters, custom_headers:nil)
2154
+ export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers:custom_headers).value!
2155
+ end
2156
+
2157
+ #
2158
+ # Exports all the device identities in the IoT hub identity registry to an
2159
+ # Azure Storage blob container. For more information, see:
2160
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities
2161
+ #
2162
+ # Exports all the device identities in the IoT hub identity registry to an
2163
+ # Azure Storage blob container. For more information, see:
2164
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
2165
+ #
2166
+ # @param resource_group_name [String] The name of the resource group that
2167
+ # contains the IoT hub.
2168
+ # @param resource_name [String] The name of the IoT hub.
2169
+ # @param export_devices_parameters [ExportDevicesRequest] The parameters that
2170
+ # specify the export devices operation.
2171
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2172
+ # to the HTTP request.
2173
+ #
2174
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2175
+ #
2176
+ def export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers:nil)
2177
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2178
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2179
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2180
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2181
+ fail ArgumentError, 'export_devices_parameters is nil' if export_devices_parameters.nil?
2182
+
2183
+
2184
+ request_headers = {}
2185
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2186
+
2187
+ # Set Headers
2188
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2189
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2190
+
2191
+ # Serialize Request
2192
+ request_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::ExportDevicesRequest.mapper()
2193
+ request_content = @client.serialize(request_mapper, export_devices_parameters)
2194
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2195
+
2196
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'
2197
+
2198
+ request_url = @base_url || @client.base_url
2199
+
2200
+ options = {
2201
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2202
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2203
+ query_params: {'api-version' => @client.api_version},
2204
+ body: request_content,
2205
+ headers: request_headers.merge(custom_headers || {}),
2206
+ base_url: request_url
2207
+ }
2208
+ promise = @client.make_request_async(:post, path_template, options)
2209
+
2210
+ promise = promise.then do |result|
2211
+ http_response = result.response
2212
+ status_code = http_response.status
2213
+ response_content = http_response.body
2214
+ unless status_code == 200
2215
+ error_model = JSON.load(response_content)
2216
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2217
+ end
2218
+
2219
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2220
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2221
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2222
+ # Deserialize Response
2223
+ if status_code == 200
2224
+ begin
2225
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2226
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::JobResponse.mapper()
2227
+ result.body = @client.deserialize(result_mapper, parsed_response)
2228
+ rescue Exception => e
2229
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2230
+ end
2231
+ end
2232
+
2233
+ result
2234
+ end
2235
+
2236
+ promise.execute
2237
+ end
2238
+
2239
+ #
2240
+ # Import, update, or delete device identities in the IoT hub identity registry
2241
+ # from a blob. For more information, see:
2242
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities
2243
+ #
2244
+ # Import, update, or delete device identities in the IoT hub identity registry
2245
+ # from a blob. For more information, see:
2246
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
2247
+ #
2248
+ # @param resource_group_name [String] The name of the resource group that
2249
+ # contains the IoT hub.
2250
+ # @param resource_name [String] The name of the IoT hub.
2251
+ # @param import_devices_parameters [ImportDevicesRequest] The parameters that
2252
+ # specify the import devices operation.
2253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2254
+ # will be added to the HTTP request.
2255
+ #
2256
+ # @return [JobResponse] operation results.
2257
+ #
2258
+ def import_devices(resource_group_name, resource_name, import_devices_parameters, custom_headers:nil)
2259
+ response = import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers:custom_headers).value!
2260
+ response.body unless response.nil?
2261
+ end
2262
+
2263
+ #
2264
+ # Import, update, or delete device identities in the IoT hub identity registry
2265
+ # from a blob. For more information, see:
2266
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities
2267
+ #
2268
+ # Import, update, or delete device identities in the IoT hub identity registry
2269
+ # from a blob. For more information, see:
2270
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
2271
+ #
2272
+ # @param resource_group_name [String] The name of the resource group that
2273
+ # contains the IoT hub.
2274
+ # @param resource_name [String] The name of the IoT hub.
2275
+ # @param import_devices_parameters [ImportDevicesRequest] The parameters that
2276
+ # specify the import devices operation.
2277
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2278
+ # will be added to the HTTP request.
2279
+ #
2280
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2281
+ #
2282
+ def import_devices_with_http_info(resource_group_name, resource_name, import_devices_parameters, custom_headers:nil)
2283
+ import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers:custom_headers).value!
2284
+ end
2285
+
2286
+ #
2287
+ # Import, update, or delete device identities in the IoT hub identity registry
2288
+ # from a blob. For more information, see:
2289
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities
2290
+ #
2291
+ # Import, update, or delete device identities in the IoT hub identity registry
2292
+ # from a blob. For more information, see:
2293
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
2294
+ #
2295
+ # @param resource_group_name [String] The name of the resource group that
2296
+ # contains the IoT hub.
2297
+ # @param resource_name [String] The name of the IoT hub.
2298
+ # @param import_devices_parameters [ImportDevicesRequest] The parameters that
2299
+ # specify the import devices operation.
2300
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2301
+ # to the HTTP request.
2302
+ #
2303
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2304
+ #
2305
+ def import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers:nil)
2306
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2307
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2308
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2309
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2310
+ fail ArgumentError, 'import_devices_parameters is nil' if import_devices_parameters.nil?
2311
+
2312
+
2313
+ request_headers = {}
2314
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2315
+
2316
+ # Set Headers
2317
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2318
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2319
+
2320
+ # Serialize Request
2321
+ request_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::ImportDevicesRequest.mapper()
2322
+ request_content = @client.serialize(request_mapper, import_devices_parameters)
2323
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2324
+
2325
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'
2326
+
2327
+ request_url = @base_url || @client.base_url
2328
+
2329
+ options = {
2330
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2331
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2332
+ query_params: {'api-version' => @client.api_version},
2333
+ body: request_content,
2334
+ headers: request_headers.merge(custom_headers || {}),
2335
+ base_url: request_url
2336
+ }
2337
+ promise = @client.make_request_async(:post, path_template, options)
2338
+
2339
+ promise = promise.then do |result|
2340
+ http_response = result.response
2341
+ status_code = http_response.status
2342
+ response_content = http_response.body
2343
+ unless status_code == 200
2344
+ error_model = JSON.load(response_content)
2345
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2346
+ end
2347
+
2348
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2349
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2350
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2351
+ # Deserialize Response
2352
+ if status_code == 200
2353
+ begin
2354
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2355
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::JobResponse.mapper()
2356
+ result.body = @client.deserialize(result_mapper, parsed_response)
2357
+ rescue Exception => e
2358
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2359
+ end
2360
+ end
2361
+
2362
+ result
2363
+ end
2364
+
2365
+ promise.execute
2366
+ end
2367
+
2368
+ #
2369
+ # Create or update the metadata of an IoT hub.
2370
+ #
2371
+ # Create or update the metadata of an Iot hub. The usual pattern to modify a
2372
+ # property is to retrieve the IoT hub metadata and security metadata, and then
2373
+ # combine them with the modified values in a new body to update the IoT hub.
2374
+ #
2375
+ # @param resource_group_name [String] The name of the resource group that
2376
+ # contains the IoT hub.
2377
+ # @param resource_name [String] The name of the IoT hub.
2378
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
2379
+ # security metadata.
2380
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
2381
+ # brand new IoT Hub. Required to update an existing IoT Hub.
2382
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2383
+ # will be added to the HTTP request.
2384
+ #
2385
+ # @return [IotHubDescription] operation results.
2386
+ #
2387
+ def begin_create_or_update(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
2388
+ response = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers).value!
2389
+ response.body unless response.nil?
2390
+ end
2391
+
2392
+ #
2393
+ # Create or update the metadata of an IoT hub.
2394
+ #
2395
+ # Create or update the metadata of an Iot hub. The usual pattern to modify a
2396
+ # property is to retrieve the IoT hub metadata and security metadata, and then
2397
+ # combine them with the modified values in a new body to update the IoT hub.
2398
+ #
2399
+ # @param resource_group_name [String] The name of the resource group that
2400
+ # contains the IoT hub.
2401
+ # @param resource_name [String] The name of the IoT hub.
2402
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
2403
+ # security metadata.
2404
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
2405
+ # brand new IoT Hub. Required to update an existing IoT Hub.
2406
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2407
+ # will be added to the HTTP request.
2408
+ #
2409
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2410
+ #
2411
+ def begin_create_or_update_with_http_info(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
2412
+ begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers).value!
2413
+ end
2414
+
2415
+ #
2416
+ # Create or update the metadata of an IoT hub.
2417
+ #
2418
+ # Create or update the metadata of an Iot hub. The usual pattern to modify a
2419
+ # property is to retrieve the IoT hub metadata and security metadata, and then
2420
+ # combine them with the modified values in a new body to update the IoT hub.
2421
+ #
2422
+ # @param resource_group_name [String] The name of the resource group that
2423
+ # contains the IoT hub.
2424
+ # @param resource_name [String] The name of the IoT hub.
2425
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
2426
+ # security metadata.
2427
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
2428
+ # brand new IoT Hub. Required to update an existing IoT Hub.
2429
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2430
+ # to the HTTP request.
2431
+ #
2432
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2433
+ #
2434
+ def begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
2435
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2436
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2437
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2438
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2439
+ fail ArgumentError, 'iot_hub_description is nil' if iot_hub_description.nil?
2440
+
2441
+
2442
+ request_headers = {}
2443
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2444
+
2445
+ # Set Headers
2446
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2447
+ request_headers['If-Match'] = if_match unless if_match.nil?
2448
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2449
+
2450
+ # Serialize Request
2451
+ request_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescription.mapper()
2452
+ request_content = @client.serialize(request_mapper, iot_hub_description)
2453
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2454
+
2455
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
2456
+
2457
+ request_url = @base_url || @client.base_url
2458
+
2459
+ options = {
2460
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2461
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2462
+ query_params: {'api-version' => @client.api_version},
2463
+ body: request_content,
2464
+ headers: request_headers.merge(custom_headers || {}),
2465
+ base_url: request_url
2466
+ }
2467
+ promise = @client.make_request_async(:put, path_template, options)
2468
+
2469
+ promise = promise.then do |result|
2470
+ http_response = result.response
2471
+ status_code = http_response.status
2472
+ response_content = http_response.body
2473
+ unless status_code == 201 || status_code == 200
2474
+ error_model = JSON.load(response_content)
2475
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2476
+ end
2477
+
2478
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2479
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2480
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2481
+ # Deserialize Response
2482
+ if status_code == 201
2483
+ begin
2484
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2485
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescription.mapper()
2486
+ result.body = @client.deserialize(result_mapper, parsed_response)
2487
+ rescue Exception => e
2488
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2489
+ end
2490
+ end
2491
+ # Deserialize Response
2492
+ if status_code == 200
2493
+ begin
2494
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2495
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescription.mapper()
2496
+ result.body = @client.deserialize(result_mapper, parsed_response)
2497
+ rescue Exception => e
2498
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2499
+ end
2500
+ end
2501
+
2502
+ result
2503
+ end
2504
+
2505
+ promise.execute
2506
+ end
2507
+
2508
+ #
2509
+ # Update an existing IoT Hubs tags.
2510
+ #
2511
+ # Update an existing IoT Hub tags. to update other fields use the
2512
+ # CreateOrUpdate method
2513
+ #
2514
+ # @param resource_group_name [String] Resource group identifier.
2515
+ # @param resource_name [String] Name of iot hub to update.
2516
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
2517
+ # iot hub instance.
2518
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2519
+ # will be added to the HTTP request.
2520
+ #
2521
+ # @return [IotHubDescription] operation results.
2522
+ #
2523
+ def begin_update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
2524
+ response = begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
2525
+ response.body unless response.nil?
2526
+ end
2527
+
2528
+ #
2529
+ # Update an existing IoT Hubs tags.
2530
+ #
2531
+ # Update an existing IoT Hub tags. to update other fields use the
2532
+ # CreateOrUpdate method
2533
+ #
2534
+ # @param resource_group_name [String] Resource group identifier.
2535
+ # @param resource_name [String] Name of iot hub to update.
2536
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
2537
+ # iot hub instance.
2538
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2539
+ # will be added to the HTTP request.
2540
+ #
2541
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2542
+ #
2543
+ def begin_update_with_http_info(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
2544
+ begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
2545
+ end
2546
+
2547
+ #
2548
+ # Update an existing IoT Hubs tags.
2549
+ #
2550
+ # Update an existing IoT Hub tags. to update other fields use the
2551
+ # CreateOrUpdate method
2552
+ #
2553
+ # @param resource_group_name [String] Resource group identifier.
2554
+ # @param resource_name [String] Name of iot hub to update.
2555
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
2556
+ # iot hub instance.
2557
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2558
+ # to the HTTP request.
2559
+ #
2560
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2561
+ #
2562
+ def begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
2563
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2564
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2565
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2566
+ fail ArgumentError, 'iot_hub_tags is nil' if iot_hub_tags.nil?
2567
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2568
+
2569
+
2570
+ request_headers = {}
2571
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2572
+
2573
+ # Set Headers
2574
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2575
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2576
+
2577
+ # Serialize Request
2578
+ request_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::TagsResource.mapper()
2579
+ request_content = @client.serialize(request_mapper, iot_hub_tags)
2580
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2581
+
2582
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
2583
+
2584
+ request_url = @base_url || @client.base_url
2585
+
2586
+ options = {
2587
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2588
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2589
+ query_params: {'api-version' => @client.api_version},
2590
+ body: request_content,
2591
+ headers: request_headers.merge(custom_headers || {}),
2592
+ base_url: request_url
2593
+ }
2594
+ promise = @client.make_request_async(:patch, path_template, options)
2595
+
2596
+ promise = promise.then do |result|
2597
+ http_response = result.response
2598
+ status_code = http_response.status
2599
+ response_content = http_response.body
2600
+ unless status_code == 200
2601
+ error_model = JSON.load(response_content)
2602
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2603
+ end
2604
+
2605
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2606
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2607
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2608
+ # Deserialize Response
2609
+ if status_code == 200
2610
+ begin
2611
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2612
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescription.mapper()
2613
+ result.body = @client.deserialize(result_mapper, parsed_response)
2614
+ rescue Exception => e
2615
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2616
+ end
2617
+ end
2618
+
2619
+ result
2620
+ end
2621
+
2622
+ promise.execute
2623
+ end
2624
+
2625
+ #
2626
+ # Delete an IoT hub
2627
+ #
2628
+ # Delete an IoT hub.
2629
+ #
2630
+ # @param resource_group_name [String] The name of the resource group that
2631
+ # contains the IoT hub.
2632
+ # @param resource_name [String] The name of the IoT hub.
2633
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2634
+ # will be added to the HTTP request.
2635
+ #
2636
+ # @return [Object] operation results.
2637
+ #
2638
+ def begin_delete(resource_group_name, resource_name, custom_headers:nil)
2639
+ response = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
2640
+ response.body unless response.nil?
2641
+ end
2642
+
2643
+ #
2644
+ # Delete an IoT hub
2645
+ #
2646
+ # Delete an IoT hub.
2647
+ #
2648
+ # @param resource_group_name [String] The name of the resource group that
2649
+ # contains the IoT hub.
2650
+ # @param resource_name [String] The name of the IoT hub.
2651
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2652
+ # will be added to the HTTP request.
2653
+ #
2654
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2655
+ #
2656
+ def begin_delete_with_http_info(resource_group_name, resource_name, custom_headers:nil)
2657
+ begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
2658
+ end
2659
+
2660
+ #
2661
+ # Delete an IoT hub
2662
+ #
2663
+ # Delete an IoT hub.
2664
+ #
2665
+ # @param resource_group_name [String] The name of the resource group that
2666
+ # contains the IoT hub.
2667
+ # @param resource_name [String] The name of the IoT hub.
2668
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2669
+ # to the HTTP request.
2670
+ #
2671
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2672
+ #
2673
+ def begin_delete_async(resource_group_name, resource_name, custom_headers:nil)
2674
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2675
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2676
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2677
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2678
+
2679
+
2680
+ request_headers = {}
2681
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2682
+
2683
+ # Set Headers
2684
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2685
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2686
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
2687
+
2688
+ request_url = @base_url || @client.base_url
2689
+
2690
+ options = {
2691
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2692
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2693
+ query_params: {'api-version' => @client.api_version},
2694
+ headers: request_headers.merge(custom_headers || {}),
2695
+ base_url: request_url
2696
+ }
2697
+ promise = @client.make_request_async(:delete, path_template, options)
2698
+
2699
+ promise = promise.then do |result|
2700
+ http_response = result.response
2701
+ status_code = http_response.status
2702
+ response_content = http_response.body
2703
+ unless status_code == 202 || status_code == 200 || status_code == 204 || status_code == 404
2704
+ error_model = JSON.load(response_content)
2705
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2706
+ end
2707
+
2708
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2709
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2710
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2711
+ # Deserialize Response
2712
+ if status_code == 202
2713
+ begin
2714
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2715
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescription.mapper()
2716
+ result.body = @client.deserialize(result_mapper, parsed_response)
2717
+ rescue Exception => e
2718
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2719
+ end
2720
+ end
2721
+ # Deserialize Response
2722
+ if status_code == 200
2723
+ begin
2724
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2725
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescription.mapper()
2726
+ result.body = @client.deserialize(result_mapper, parsed_response)
2727
+ rescue Exception => e
2728
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2729
+ end
2730
+ end
2731
+ # Deserialize Response
2732
+ if status_code == 404
2733
+ begin
2734
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2735
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::ErrorDetails.mapper()
2736
+ result.body = @client.deserialize(result_mapper, parsed_response)
2737
+ rescue Exception => e
2738
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2739
+ end
2740
+ end
2741
+
2742
+ result
2743
+ end
2744
+
2745
+ promise.execute
2746
+ end
2747
+
2748
+ #
2749
+ # Get all the IoT hubs in a subscription
2750
+ #
2751
+ # Get all the IoT hubs in a subscription.
2752
+ #
2753
+ # @param next_page_link [String] The NextLink from the previous successful call
2754
+ # to List operation.
2755
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2756
+ # will be added to the HTTP request.
2757
+ #
2758
+ # @return [IotHubDescriptionListResult] operation results.
2759
+ #
2760
+ def list_by_subscription_next(next_page_link, custom_headers:nil)
2761
+ response = list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
2762
+ response.body unless response.nil?
2763
+ end
2764
+
2765
+ #
2766
+ # Get all the IoT hubs in a subscription
2767
+ #
2768
+ # Get all the IoT hubs in a subscription.
2769
+ #
2770
+ # @param next_page_link [String] The NextLink from the previous successful call
2771
+ # to List operation.
2772
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2773
+ # will be added to the HTTP request.
2774
+ #
2775
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2776
+ #
2777
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers:nil)
2778
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
2779
+ end
2780
+
2781
+ #
2782
+ # Get all the IoT hubs in a subscription
2783
+ #
2784
+ # Get all the IoT hubs in a subscription.
2785
+ #
2786
+ # @param next_page_link [String] The NextLink from the previous successful call
2787
+ # to List operation.
2788
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2789
+ # to the HTTP request.
2790
+ #
2791
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2792
+ #
2793
+ def list_by_subscription_next_async(next_page_link, custom_headers:nil)
2794
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2795
+
2796
+
2797
+ request_headers = {}
2798
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2799
+
2800
+ # Set Headers
2801
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2802
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2803
+ path_template = '{nextLink}'
2804
+
2805
+ request_url = @base_url || @client.base_url
2806
+
2807
+ options = {
2808
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2809
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2810
+ headers: request_headers.merge(custom_headers || {}),
2811
+ base_url: request_url
2812
+ }
2813
+ promise = @client.make_request_async(:get, path_template, options)
2814
+
2815
+ promise = promise.then do |result|
2816
+ http_response = result.response
2817
+ status_code = http_response.status
2818
+ response_content = http_response.body
2819
+ unless status_code == 200
2820
+ error_model = JSON.load(response_content)
2821
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2822
+ end
2823
+
2824
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2825
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2826
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2827
+ # Deserialize Response
2828
+ if status_code == 200
2829
+ begin
2830
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2831
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescriptionListResult.mapper()
2832
+ result.body = @client.deserialize(result_mapper, parsed_response)
2833
+ rescue Exception => e
2834
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2835
+ end
2836
+ end
2837
+
2838
+ result
2839
+ end
2840
+
2841
+ promise.execute
2842
+ end
2843
+
2844
+ #
2845
+ # Get all the IoT hubs in a resource group
2846
+ #
2847
+ # Get all the IoT hubs in a resource group.
2848
+ #
2849
+ # @param next_page_link [String] The NextLink from the previous successful call
2850
+ # to List operation.
2851
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2852
+ # will be added to the HTTP request.
2853
+ #
2854
+ # @return [IotHubDescriptionListResult] operation results.
2855
+ #
2856
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
2857
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2858
+ response.body unless response.nil?
2859
+ end
2860
+
2861
+ #
2862
+ # Get all the IoT hubs in a resource group
2863
+ #
2864
+ # Get all the IoT hubs in a resource group.
2865
+ #
2866
+ # @param next_page_link [String] The NextLink from the previous successful call
2867
+ # to List operation.
2868
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2869
+ # will be added to the HTTP request.
2870
+ #
2871
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2872
+ #
2873
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
2874
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2875
+ end
2876
+
2877
+ #
2878
+ # Get all the IoT hubs in a resource group
2879
+ #
2880
+ # Get all the IoT hubs in a resource group.
2881
+ #
2882
+ # @param next_page_link [String] The NextLink from the previous successful call
2883
+ # to List operation.
2884
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2885
+ # to the HTTP request.
2886
+ #
2887
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2888
+ #
2889
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
2890
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2891
+
2892
+
2893
+ request_headers = {}
2894
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2895
+
2896
+ # Set Headers
2897
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2898
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2899
+ path_template = '{nextLink}'
2900
+
2901
+ request_url = @base_url || @client.base_url
2902
+
2903
+ options = {
2904
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2905
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2906
+ headers: request_headers.merge(custom_headers || {}),
2907
+ base_url: request_url
2908
+ }
2909
+ promise = @client.make_request_async(:get, path_template, options)
2910
+
2911
+ promise = promise.then do |result|
2912
+ http_response = result.response
2913
+ status_code = http_response.status
2914
+ response_content = http_response.body
2915
+ unless status_code == 200
2916
+ error_model = JSON.load(response_content)
2917
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2918
+ end
2919
+
2920
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2921
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2922
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2923
+ # Deserialize Response
2924
+ if status_code == 200
2925
+ begin
2926
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2927
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubDescriptionListResult.mapper()
2928
+ result.body = @client.deserialize(result_mapper, parsed_response)
2929
+ rescue Exception => e
2930
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2931
+ end
2932
+ end
2933
+
2934
+ result
2935
+ end
2936
+
2937
+ promise.execute
2938
+ end
2939
+
2940
+ #
2941
+ # Get the list of valid SKUs for an IoT hub
2942
+ #
2943
+ # Get the list of valid SKUs for an IoT hub.
2944
+ #
2945
+ # @param next_page_link [String] The NextLink from the previous successful call
2946
+ # to List operation.
2947
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2948
+ # will be added to the HTTP request.
2949
+ #
2950
+ # @return [IotHubSkuDescriptionListResult] operation results.
2951
+ #
2952
+ def get_valid_skus_next(next_page_link, custom_headers:nil)
2953
+ response = get_valid_skus_next_async(next_page_link, custom_headers:custom_headers).value!
2954
+ response.body unless response.nil?
2955
+ end
2956
+
2957
+ #
2958
+ # Get the list of valid SKUs for an IoT hub
2959
+ #
2960
+ # Get the list of valid SKUs for an IoT hub.
2961
+ #
2962
+ # @param next_page_link [String] The NextLink from the previous successful call
2963
+ # to List operation.
2964
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2965
+ # will be added to the HTTP request.
2966
+ #
2967
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2968
+ #
2969
+ def get_valid_skus_next_with_http_info(next_page_link, custom_headers:nil)
2970
+ get_valid_skus_next_async(next_page_link, custom_headers:custom_headers).value!
2971
+ end
2972
+
2973
+ #
2974
+ # Get the list of valid SKUs for an IoT hub
2975
+ #
2976
+ # Get the list of valid SKUs for an IoT hub.
2977
+ #
2978
+ # @param next_page_link [String] The NextLink from the previous successful call
2979
+ # to List operation.
2980
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2981
+ # to the HTTP request.
2982
+ #
2983
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2984
+ #
2985
+ def get_valid_skus_next_async(next_page_link, custom_headers:nil)
2986
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2987
+
2988
+
2989
+ request_headers = {}
2990
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2991
+
2992
+ # Set Headers
2993
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2994
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2995
+ path_template = '{nextLink}'
2996
+
2997
+ request_url = @base_url || @client.base_url
2998
+
2999
+ options = {
3000
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3001
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3002
+ headers: request_headers.merge(custom_headers || {}),
3003
+ base_url: request_url
3004
+ }
3005
+ promise = @client.make_request_async(:get, path_template, options)
3006
+
3007
+ promise = promise.then do |result|
3008
+ http_response = result.response
3009
+ status_code = http_response.status
3010
+ response_content = http_response.body
3011
+ unless status_code == 200
3012
+ error_model = JSON.load(response_content)
3013
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3014
+ end
3015
+
3016
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3017
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3018
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3019
+ # Deserialize Response
3020
+ if status_code == 200
3021
+ begin
3022
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3023
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubSkuDescriptionListResult.mapper()
3024
+ result.body = @client.deserialize(result_mapper, parsed_response)
3025
+ rescue Exception => e
3026
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3027
+ end
3028
+ end
3029
+
3030
+ result
3031
+ end
3032
+
3033
+ promise.execute
3034
+ end
3035
+
3036
+ #
3037
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3038
+ # endpoint in an IoT hub
3039
+ #
3040
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3041
+ # endpoint in an IoT hub.
3042
+ #
3043
+ # @param next_page_link [String] The NextLink from the previous successful call
3044
+ # to List operation.
3045
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3046
+ # will be added to the HTTP request.
3047
+ #
3048
+ # @return [EventHubConsumerGroupsListResult] operation results.
3049
+ #
3050
+ def list_event_hub_consumer_groups_next(next_page_link, custom_headers:nil)
3051
+ response = list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:custom_headers).value!
3052
+ response.body unless response.nil?
3053
+ end
3054
+
3055
+ #
3056
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3057
+ # endpoint in an IoT hub
3058
+ #
3059
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3060
+ # endpoint in an IoT hub.
3061
+ #
3062
+ # @param next_page_link [String] The NextLink from the previous successful call
3063
+ # to List operation.
3064
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3065
+ # will be added to the HTTP request.
3066
+ #
3067
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3068
+ #
3069
+ def list_event_hub_consumer_groups_next_with_http_info(next_page_link, custom_headers:nil)
3070
+ list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:custom_headers).value!
3071
+ end
3072
+
3073
+ #
3074
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3075
+ # endpoint in an IoT hub
3076
+ #
3077
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3078
+ # endpoint in an IoT hub.
3079
+ #
3080
+ # @param next_page_link [String] The NextLink from the previous successful call
3081
+ # to List operation.
3082
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3083
+ # to the HTTP request.
3084
+ #
3085
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3086
+ #
3087
+ def list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:nil)
3088
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3089
+
3090
+
3091
+ request_headers = {}
3092
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3093
+
3094
+ # Set Headers
3095
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3096
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3097
+ path_template = '{nextLink}'
3098
+
3099
+ request_url = @base_url || @client.base_url
3100
+
3101
+ options = {
3102
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3103
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3104
+ headers: request_headers.merge(custom_headers || {}),
3105
+ base_url: request_url
3106
+ }
3107
+ promise = @client.make_request_async(:get, path_template, options)
3108
+
3109
+ promise = promise.then do |result|
3110
+ http_response = result.response
3111
+ status_code = http_response.status
3112
+ response_content = http_response.body
3113
+ unless status_code == 200
3114
+ error_model = JSON.load(response_content)
3115
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3116
+ end
3117
+
3118
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3119
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3120
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3121
+ # Deserialize Response
3122
+ if status_code == 200
3123
+ begin
3124
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3125
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::EventHubConsumerGroupsListResult.mapper()
3126
+ result.body = @client.deserialize(result_mapper, parsed_response)
3127
+ rescue Exception => e
3128
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3129
+ end
3130
+ end
3131
+
3132
+ result
3133
+ end
3134
+
3135
+ promise.execute
3136
+ end
3137
+
3138
+ #
3139
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3140
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
3141
+ #
3142
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3143
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
3144
+ #
3145
+ # @param next_page_link [String] The NextLink from the previous successful call
3146
+ # to List operation.
3147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3148
+ # will be added to the HTTP request.
3149
+ #
3150
+ # @return [JobResponseListResult] operation results.
3151
+ #
3152
+ def list_jobs_next(next_page_link, custom_headers:nil)
3153
+ response = list_jobs_next_async(next_page_link, custom_headers:custom_headers).value!
3154
+ response.body unless response.nil?
3155
+ end
3156
+
3157
+ #
3158
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3159
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
3160
+ #
3161
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3162
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
3163
+ #
3164
+ # @param next_page_link [String] The NextLink from the previous successful call
3165
+ # to List operation.
3166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3167
+ # will be added to the HTTP request.
3168
+ #
3169
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3170
+ #
3171
+ def list_jobs_next_with_http_info(next_page_link, custom_headers:nil)
3172
+ list_jobs_next_async(next_page_link, custom_headers:custom_headers).value!
3173
+ end
3174
+
3175
+ #
3176
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3177
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
3178
+ #
3179
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3180
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
3181
+ #
3182
+ # @param next_page_link [String] The NextLink from the previous successful call
3183
+ # to List operation.
3184
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3185
+ # to the HTTP request.
3186
+ #
3187
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3188
+ #
3189
+ def list_jobs_next_async(next_page_link, custom_headers:nil)
3190
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3191
+
3192
+
3193
+ request_headers = {}
3194
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3195
+
3196
+ # Set Headers
3197
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3198
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3199
+ path_template = '{nextLink}'
3200
+
3201
+ request_url = @base_url || @client.base_url
3202
+
3203
+ options = {
3204
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3205
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3206
+ headers: request_headers.merge(custom_headers || {}),
3207
+ base_url: request_url
3208
+ }
3209
+ promise = @client.make_request_async(:get, path_template, options)
3210
+
3211
+ promise = promise.then do |result|
3212
+ http_response = result.response
3213
+ status_code = http_response.status
3214
+ response_content = http_response.body
3215
+ unless status_code == 200
3216
+ error_model = JSON.load(response_content)
3217
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3218
+ end
3219
+
3220
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3221
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3222
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3223
+ # Deserialize Response
3224
+ if status_code == 200
3225
+ begin
3226
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3227
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::JobResponseListResult.mapper()
3228
+ result.body = @client.deserialize(result_mapper, parsed_response)
3229
+ rescue Exception => e
3230
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3231
+ end
3232
+ end
3233
+
3234
+ result
3235
+ end
3236
+
3237
+ promise.execute
3238
+ end
3239
+
3240
+ #
3241
+ # Get the quota metrics for an IoT hub
3242
+ #
3243
+ # Get the quota metrics for an IoT hub.
3244
+ #
3245
+ # @param next_page_link [String] The NextLink from the previous successful call
3246
+ # to List operation.
3247
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3248
+ # will be added to the HTTP request.
3249
+ #
3250
+ # @return [IotHubQuotaMetricInfoListResult] operation results.
3251
+ #
3252
+ def get_quota_metrics_next(next_page_link, custom_headers:nil)
3253
+ response = get_quota_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
3254
+ response.body unless response.nil?
3255
+ end
3256
+
3257
+ #
3258
+ # Get the quota metrics for an IoT hub
3259
+ #
3260
+ # Get the quota metrics for an IoT hub.
3261
+ #
3262
+ # @param next_page_link [String] The NextLink from the previous successful call
3263
+ # to List operation.
3264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3265
+ # will be added to the HTTP request.
3266
+ #
3267
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3268
+ #
3269
+ def get_quota_metrics_next_with_http_info(next_page_link, custom_headers:nil)
3270
+ get_quota_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
3271
+ end
3272
+
3273
+ #
3274
+ # Get the quota metrics for an IoT hub
3275
+ #
3276
+ # Get the quota metrics for an IoT hub.
3277
+ #
3278
+ # @param next_page_link [String] The NextLink from the previous successful call
3279
+ # to List operation.
3280
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3281
+ # to the HTTP request.
3282
+ #
3283
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3284
+ #
3285
+ def get_quota_metrics_next_async(next_page_link, custom_headers:nil)
3286
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3287
+
3288
+
3289
+ request_headers = {}
3290
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3291
+
3292
+ # Set Headers
3293
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3294
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3295
+ path_template = '{nextLink}'
3296
+
3297
+ request_url = @base_url || @client.base_url
3298
+
3299
+ options = {
3300
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3301
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3302
+ headers: request_headers.merge(custom_headers || {}),
3303
+ base_url: request_url
3304
+ }
3305
+ promise = @client.make_request_async(:get, path_template, options)
3306
+
3307
+ promise = promise.then do |result|
3308
+ http_response = result.response
3309
+ status_code = http_response.status
3310
+ response_content = http_response.body
3311
+ unless status_code == 200
3312
+ error_model = JSON.load(response_content)
3313
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3314
+ end
3315
+
3316
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3317
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3318
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3319
+ # Deserialize Response
3320
+ if status_code == 200
3321
+ begin
3322
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3323
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::IotHubQuotaMetricInfoListResult.mapper()
3324
+ result.body = @client.deserialize(result_mapper, parsed_response)
3325
+ rescue Exception => e
3326
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3327
+ end
3328
+ end
3329
+
3330
+ result
3331
+ end
3332
+
3333
+ promise.execute
3334
+ end
3335
+
3336
+ #
3337
+ # Get the health for routing endpoints
3338
+ #
3339
+ # Get the health for routing endpoints.
3340
+ #
3341
+ # @param next_page_link [String] The NextLink from the previous successful call
3342
+ # to List operation.
3343
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3344
+ # will be added to the HTTP request.
3345
+ #
3346
+ # @return [EndpointHealthDataListResult] operation results.
3347
+ #
3348
+ def get_endpoint_health_next(next_page_link, custom_headers:nil)
3349
+ response = get_endpoint_health_next_async(next_page_link, custom_headers:custom_headers).value!
3350
+ response.body unless response.nil?
3351
+ end
3352
+
3353
+ #
3354
+ # Get the health for routing endpoints
3355
+ #
3356
+ # Get the health for routing endpoints.
3357
+ #
3358
+ # @param next_page_link [String] The NextLink from the previous successful call
3359
+ # to List operation.
3360
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3361
+ # will be added to the HTTP request.
3362
+ #
3363
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3364
+ #
3365
+ def get_endpoint_health_next_with_http_info(next_page_link, custom_headers:nil)
3366
+ get_endpoint_health_next_async(next_page_link, custom_headers:custom_headers).value!
3367
+ end
3368
+
3369
+ #
3370
+ # Get the health for routing endpoints
3371
+ #
3372
+ # Get the health for routing endpoints.
3373
+ #
3374
+ # @param next_page_link [String] The NextLink from the previous successful call
3375
+ # to List operation.
3376
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3377
+ # to the HTTP request.
3378
+ #
3379
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3380
+ #
3381
+ def get_endpoint_health_next_async(next_page_link, custom_headers:nil)
3382
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3383
+
3384
+
3385
+ request_headers = {}
3386
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3387
+
3388
+ # Set Headers
3389
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3390
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3391
+ path_template = '{nextLink}'
3392
+
3393
+ request_url = @base_url || @client.base_url
3394
+
3395
+ options = {
3396
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3397
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3398
+ headers: request_headers.merge(custom_headers || {}),
3399
+ base_url: request_url
3400
+ }
3401
+ promise = @client.make_request_async(:get, path_template, options)
3402
+
3403
+ promise = promise.then do |result|
3404
+ http_response = result.response
3405
+ status_code = http_response.status
3406
+ response_content = http_response.body
3407
+ unless status_code == 200
3408
+ error_model = JSON.load(response_content)
3409
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3410
+ end
3411
+
3412
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3413
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3414
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3415
+ # Deserialize Response
3416
+ if status_code == 200
3417
+ begin
3418
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3419
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::EndpointHealthDataListResult.mapper()
3420
+ result.body = @client.deserialize(result_mapper, parsed_response)
3421
+ rescue Exception => e
3422
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3423
+ end
3424
+ end
3425
+
3426
+ result
3427
+ end
3428
+
3429
+ promise.execute
3430
+ end
3431
+
3432
+ #
3433
+ # Get the security metadata for an IoT hub. For more information, see:
3434
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
3435
+ #
3436
+ # Get the security metadata for an IoT hub. For more information, see:
3437
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
3438
+ #
3439
+ # @param next_page_link [String] The NextLink from the previous successful call
3440
+ # to List operation.
3441
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3442
+ # will be added to the HTTP request.
3443
+ #
3444
+ # @return [SharedAccessSignatureAuthorizationRuleListResult] operation results.
3445
+ #
3446
+ def list_keys_next(next_page_link, custom_headers:nil)
3447
+ response = list_keys_next_async(next_page_link, custom_headers:custom_headers).value!
3448
+ response.body unless response.nil?
3449
+ end
3450
+
3451
+ #
3452
+ # Get the security metadata for an IoT hub. For more information, see:
3453
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
3454
+ #
3455
+ # Get the security metadata for an IoT hub. For more information, see:
3456
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
3457
+ #
3458
+ # @param next_page_link [String] The NextLink from the previous successful call
3459
+ # to List operation.
3460
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3461
+ # will be added to the HTTP request.
3462
+ #
3463
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3464
+ #
3465
+ def list_keys_next_with_http_info(next_page_link, custom_headers:nil)
3466
+ list_keys_next_async(next_page_link, custom_headers:custom_headers).value!
3467
+ end
3468
+
3469
+ #
3470
+ # Get the security metadata for an IoT hub. For more information, see:
3471
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
3472
+ #
3473
+ # Get the security metadata for an IoT hub. For more information, see:
3474
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
3475
+ #
3476
+ # @param next_page_link [String] The NextLink from the previous successful call
3477
+ # to List operation.
3478
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3479
+ # to the HTTP request.
3480
+ #
3481
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3482
+ #
3483
+ def list_keys_next_async(next_page_link, custom_headers:nil)
3484
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3485
+
3486
+
3487
+ request_headers = {}
3488
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3489
+
3490
+ # Set Headers
3491
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3492
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3493
+ path_template = '{nextLink}'
3494
+
3495
+ request_url = @base_url || @client.base_url
3496
+
3497
+ options = {
3498
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3499
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3500
+ headers: request_headers.merge(custom_headers || {}),
3501
+ base_url: request_url
3502
+ }
3503
+ promise = @client.make_request_async(:post, path_template, options)
3504
+
3505
+ promise = promise.then do |result|
3506
+ http_response = result.response
3507
+ status_code = http_response.status
3508
+ response_content = http_response.body
3509
+ unless status_code == 200
3510
+ error_model = JSON.load(response_content)
3511
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3512
+ end
3513
+
3514
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3515
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3516
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3517
+ # Deserialize Response
3518
+ if status_code == 200
3519
+ begin
3520
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3521
+ result_mapper = Azure::IotHub::Mgmt::V2019_07_01_preview::Models::SharedAccessSignatureAuthorizationRuleListResult.mapper()
3522
+ result.body = @client.deserialize(result_mapper, parsed_response)
3523
+ rescue Exception => e
3524
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3525
+ end
3526
+ end
3527
+
3528
+ result
3529
+ end
3530
+
3531
+ promise.execute
3532
+ end
3533
+
3534
+ #
3535
+ # Get all the IoT hubs in a subscription
3536
+ #
3537
+ # Get all the IoT hubs in a subscription.
3538
+ #
3539
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3540
+ # will be added to the HTTP request.
3541
+ #
3542
+ # @return [IotHubDescriptionListResult] which provide lazy access to pages of
3543
+ # the response.
3544
+ #
3545
+ def list_by_subscription_as_lazy(custom_headers:nil)
3546
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
3547
+ unless response.nil?
3548
+ page = response.body
3549
+ page.next_method = Proc.new do |next_page_link|
3550
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers)
3551
+ end
3552
+ page
3553
+ end
3554
+ end
3555
+
3556
+ #
3557
+ # Get all the IoT hubs in a resource group
3558
+ #
3559
+ # Get all the IoT hubs in a resource group.
3560
+ #
3561
+ # @param resource_group_name [String] The name of the resource group that
3562
+ # contains the IoT hub.
3563
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3564
+ # will be added to the HTTP request.
3565
+ #
3566
+ # @return [IotHubDescriptionListResult] which provide lazy access to pages of
3567
+ # the response.
3568
+ #
3569
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
3570
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
3571
+ unless response.nil?
3572
+ page = response.body
3573
+ page.next_method = Proc.new do |next_page_link|
3574
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
3575
+ end
3576
+ page
3577
+ end
3578
+ end
3579
+
3580
+ #
3581
+ # Get the list of valid SKUs for an IoT hub
3582
+ #
3583
+ # Get the list of valid SKUs for an IoT hub.
3584
+ #
3585
+ # @param resource_group_name [String] The name of the resource group that
3586
+ # contains the IoT hub.
3587
+ # @param resource_name [String] The name of the IoT hub.
3588
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3589
+ # will be added to the HTTP request.
3590
+ #
3591
+ # @return [IotHubSkuDescriptionListResult] which provide lazy access to pages
3592
+ # of the response.
3593
+ #
3594
+ def get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers:nil)
3595
+ response = get_valid_skus_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
3596
+ unless response.nil?
3597
+ page = response.body
3598
+ page.next_method = Proc.new do |next_page_link|
3599
+ get_valid_skus_next_async(next_page_link, custom_headers:custom_headers)
3600
+ end
3601
+ page
3602
+ end
3603
+ end
3604
+
3605
+ #
3606
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3607
+ # endpoint in an IoT hub
3608
+ #
3609
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3610
+ # endpoint in an IoT hub.
3611
+ #
3612
+ # @param resource_group_name [String] The name of the resource group that
3613
+ # contains the IoT hub.
3614
+ # @param resource_name [String] The name of the IoT hub.
3615
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
3616
+ # endpoint.
3617
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3618
+ # will be added to the HTTP request.
3619
+ #
3620
+ # @return [EventHubConsumerGroupsListResult] which provide lazy access to pages
3621
+ # of the response.
3622
+ #
3623
+ def list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
3624
+ response = list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers).value!
3625
+ unless response.nil?
3626
+ page = response.body
3627
+ page.next_method = Proc.new do |next_page_link|
3628
+ list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:custom_headers)
3629
+ end
3630
+ page
3631
+ end
3632
+ end
3633
+
3634
+ #
3635
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3636
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry
3637
+ #
3638
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3639
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
3640
+ #
3641
+ # @param resource_group_name [String] The name of the resource group that
3642
+ # contains the IoT hub.
3643
+ # @param resource_name [String] The name of the IoT hub.
3644
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3645
+ # will be added to the HTTP request.
3646
+ #
3647
+ # @return [JobResponseListResult] which provide lazy access to pages of the
3648
+ # response.
3649
+ #
3650
+ def list_jobs_as_lazy(resource_group_name, resource_name, custom_headers:nil)
3651
+ response = list_jobs_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
3652
+ unless response.nil?
3653
+ page = response.body
3654
+ page.next_method = Proc.new do |next_page_link|
3655
+ list_jobs_next_async(next_page_link, custom_headers:custom_headers)
3656
+ end
3657
+ page
3658
+ end
3659
+ end
3660
+
3661
+ #
3662
+ # Get the quota metrics for an IoT hub
3663
+ #
3664
+ # Get the quota metrics for an IoT hub.
3665
+ #
3666
+ # @param resource_group_name [String] The name of the resource group that
3667
+ # contains the IoT hub.
3668
+ # @param resource_name [String] The name of the IoT hub.
3669
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3670
+ # will be added to the HTTP request.
3671
+ #
3672
+ # @return [IotHubQuotaMetricInfoListResult] which provide lazy access to pages
3673
+ # of the response.
3674
+ #
3675
+ def get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers:nil)
3676
+ response = get_quota_metrics_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
3677
+ unless response.nil?
3678
+ page = response.body
3679
+ page.next_method = Proc.new do |next_page_link|
3680
+ get_quota_metrics_next_async(next_page_link, custom_headers:custom_headers)
3681
+ end
3682
+ page
3683
+ end
3684
+ end
3685
+
3686
+ #
3687
+ # Get the health for routing endpoints
3688
+ #
3689
+ # Get the health for routing endpoints.
3690
+ #
3691
+ # @param resource_group_name [String]
3692
+ # @param iot_hub_name [String]
3693
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3694
+ # will be added to the HTTP request.
3695
+ #
3696
+ # @return [EndpointHealthDataListResult] which provide lazy access to pages of
3697
+ # the response.
3698
+ #
3699
+ def get_endpoint_health_as_lazy(resource_group_name, iot_hub_name, custom_headers:nil)
3700
+ response = get_endpoint_health_async(resource_group_name, iot_hub_name, custom_headers:custom_headers).value!
3701
+ unless response.nil?
3702
+ page = response.body
3703
+ page.next_method = Proc.new do |next_page_link|
3704
+ get_endpoint_health_next_async(next_page_link, custom_headers:custom_headers)
3705
+ end
3706
+ page
3707
+ end
3708
+ end
3709
+
3710
+ #
3711
+ # Get the security metadata for an IoT hub. For more information, see:
3712
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security
3713
+ #
3714
+ # Get the security metadata for an IoT hub. For more information, see:
3715
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
3716
+ #
3717
+ # @param resource_group_name [String] The name of the resource group that
3718
+ # contains the IoT hub.
3719
+ # @param resource_name [String] The name of the IoT hub.
3720
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3721
+ # will be added to the HTTP request.
3722
+ #
3723
+ # @return [SharedAccessSignatureAuthorizationRuleListResult] which provide lazy
3724
+ # access to pages of the response.
3725
+ #
3726
+ def list_keys_as_lazy(resource_group_name, resource_name, custom_headers:nil)
3727
+ response = list_keys_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
3728
+ unless response.nil?
3729
+ page = response.body
3730
+ page.next_method = Proc.new do |next_page_link|
3731
+ list_keys_next_async(next_page_link, custom_headers:custom_headers)
3732
+ end
3733
+ page
3734
+ end
3735
+ end
3736
+
3737
+ end
3738
+ end