Class: Azure::ARM::IotHub::IotHubResource

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb

Overview

API for using the IoT Hub Features.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ IotHubResource

Creates and initializes a new instance of the IotHubResource class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientIotHubClient (readonly)

Returns reference to the IotHubClient.

Returns:



23
24
25
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 23

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, resource_name, iot_hub_description, custom_headers = nil) ⇒ IotHubDescription

Create or update an IotHub.

Create or update an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • iot_hub_description (IotHubDescription)

    The Iot hub description.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



181
182
183
184
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 181

def begin_create_or_update(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
  response = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers = nil) ⇒ Concurrent::Promise

Create or update an IotHub.

Create or update an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • iot_hub_description (IotHubDescription)

    The Iot hub description.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 216

def begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'iot_hub_description is nil' if iot_hub_description.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = IotHubDescription.mapper()
  request_content = @client.serialize(request_mapper,  iot_hub_description, 'iot_hub_description')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_create_or_update_with_http_info(resource_group_name, resource_name, iot_hub_description, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Create or update an IotHub.

Create or update an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • iot_hub_description (IotHubDescription)

    The Iot hub description.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



199
200
201
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 199

def begin_create_or_update_with_http_info(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
  begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers).value!
end

#begin_delete(resource_group_name, resource_name, custom_headers = nil) ⇒ IotHubDescription

Delete an IotHub.

Delete an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



334
335
336
337
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 334

def begin_delete(resource_group_name, resource_name, custom_headers = nil)
  response = begin_delete_async(resource_group_name, resource_name, custom_headers).value!
  response.body unless response.nil?
end

#begin_delete_async(resource_group_name, resource_name, custom_headers = nil) ⇒ Concurrent::Promise

Delete an IotHub.

Delete an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 367

def begin_delete_async(resource_group_name, resource_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_delete_with_http_info(resource_group_name, resource_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Delete an IotHub.

Delete an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



351
352
353
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 351

def begin_delete_with_http_info(resource_group_name, resource_name, custom_headers = nil)
  begin_delete_async(resource_group_name, resource_name, custom_headers).value!
end

#check_name_availability(operation_inputs, custom_headers = nil) ⇒ IotHubNameAvailabilityInfo

Check if an IotHub name is available.

Check if an IotHub name is available.

parameter in the operationInputs structure to the desired iothub name. will be added to the HTTP request.

Parameters:

  • operation_inputs (OperationInputs)

    The operation inputs. Set the name

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1649
1650
1651
1652
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1649

def check_name_availability(operation_inputs, custom_headers = nil)
  response = check_name_availability_async(operation_inputs, custom_headers).value!
  response.body unless response.nil?
end

#check_name_availability_async(operation_inputs, custom_headers = nil) ⇒ Concurrent::Promise

Check if an IotHub name is available.

Check if an IotHub name is available.

parameter in the operationInputs structure to the desired iothub name. to the HTTP request.

Parameters:

  • operation_inputs (OperationInputs)

    The operation inputs. Set the name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1682

def check_name_availability_async(operation_inputs, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'operation_inputs is nil' if operation_inputs.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = OperationInputs.mapper()
  request_content = @client.serialize(request_mapper,  operation_inputs, 'operation_inputs')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubNameAvailabilityInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#check_name_availability_with_http_info(operation_inputs, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Check if an IotHub name is available.

Check if an IotHub name is available.

parameter in the operationInputs structure to the desired iothub name. will be added to the HTTP request.

Parameters:

  • operation_inputs (OperationInputs)

    The operation inputs. Set the name

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1666
1667
1668
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1666

def check_name_availability_with_http_info(operation_inputs, custom_headers = nil)
  check_name_availability_async(operation_inputs, custom_headers).value!
end

#create_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil) ⇒ EventHubConsumerGroupInfo

Add an EventHub Consumer Group to an IotHub.

Add an EventHub Consumer Group to an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • name (String)

    The name of the consumer group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1109
1110
1111
1112
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1109

def create_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
  response = create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
  response.body unless response.nil?
end

#create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Add an EventHub Consumer Group to an IotHub.

Add an EventHub Consumer Group to an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • name (String)

    The name of the consumer group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1146

def create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = EventHubConsumerGroupInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#create_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Add an EventHub Consumer Group to an IotHub.

Add an EventHub Consumer Group to an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • name (String)

    The name of the consumer group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1128
1129
1130
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1128

def create_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
  create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
end

#create_or_update(resource_group_name, resource_name, iot_hub_description, custom_headers = nil) ⇒ IotHubDescription

Create or update an IotHub.

Create or update an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • iot_hub_description (IotHubDescription)

    The Iot hub description.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



135
136
137
138
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 135

def create_or_update(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
  response = create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • iot_hub_description (IotHubDescription)

    The Iot hub description.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 150

def create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers = nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = IotHubDescription.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete(resource_group_name, resource_name, custom_headers = nil) ⇒ IotHubDescription

Delete an IotHub.

Delete an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



290
291
292
293
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 290

def delete(resource_group_name, resource_name, custom_headers = nil)
  response = delete_async(resource_group_name, resource_name, custom_headers).value!
  response.body unless response.nil?
end

#delete_async(resource_group_name, resource_name, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 304

def delete_async(resource_group_name, resource_name, custom_headers = nil)
  # Send request
  promise = begin_delete_async(resource_group_name, resource_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = IotHubDescription.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil) ⇒ Object

Delete EventHub Consumer Group for an IotHub.

Delete EventHub Consumer Group for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • name (String)

    The name of the consumer group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1213
1214
1215
1216
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1213

def delete_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
  response = delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
  nil
end

#delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Delete EventHub Consumer Group for an IotHub.

Delete EventHub Consumer Group for an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • name (String)

    The name of the consumer group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1250

def delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#delete_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Delete EventHub Consumer Group for an IotHub.

Delete EventHub Consumer Group for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • name (String)

    The name of the consumer group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1232
1233
1234
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1232

def delete_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
  delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
end

#export_devices(resource_group_name, resource_name, export_devices_parameters, custom_headers = nil) ⇒ JobResponse

Export all the devices in an IotHub.

Export all the devices in an IotHub.

parameters. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • export_devices_parameters (ExportDevicesRequest)

    The export devices

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1978
1979
1980
1981
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1978

def export_devices(resource_group_name, resource_name, export_devices_parameters, custom_headers = nil)
  response = export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers).value!
  response.body unless response.nil?
end

#export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers = nil) ⇒ Concurrent::Promise

Export all the devices in an IotHub.

Export all the devices in an IotHub.

parameters. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • export_devices_parameters (ExportDevicesRequest)

    The export devices

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2015

def export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'export_devices_parameters is nil' if export_devices_parameters.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = ExportDevicesRequest.mapper()
  request_content = @client.serialize(request_mapper,  export_devices_parameters, 'export_devices_parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobResponse.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#export_devices_with_http_info(resource_group_name, resource_name, export_devices_parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Export all the devices in an IotHub.

Export all the devices in an IotHub.

parameters. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • export_devices_parameters (ExportDevicesRequest)

    The export devices

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1997
1998
1999
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1997

def export_devices_with_http_info(resource_group_name, resource_name, export_devices_parameters, custom_headers = nil)
  export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers).value!
end

#get(resource_group_name, resource_name, custom_headers = nil) ⇒ IotHubDescription

Get an IotHub.

Get an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



37
38
39
40
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 37

def get(resource_group_name, resource_name, custom_headers = nil)
  response = get_async(resource_group_name, resource_name, custom_headers).value!
  response.body unless response.nil?
end

#get_async(resource_group_name, resource_name, custom_headers = nil) ⇒ Concurrent::Promise

Get an IotHub.

Get an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 70

def get_async(resource_group_name, resource_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil) ⇒ EventHubConsumerGroupInfo

Get EventHub Consumer Group for an IotHub.

Get EventHub Consumer Group for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • name (String)

    The name of the consumer group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1004
1005
1006
1007
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1004

def get_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
  response = get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
  response.body unless response.nil?
end

#get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Get EventHub Consumer Group for an IotHub.

Get EventHub Consumer Group for an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • name (String)

    The name of the consumer group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1041

def get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = EventHubConsumerGroupInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get EventHub Consumer Group for an IotHub.

Get EventHub Consumer Group for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • name (String)

    The name of the consumer group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1023
1024
1025
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1023

def get_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers = nil)
  get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers).value!
end

#get_job(resource_group_name, resource_name, job_id, custom_headers = nil) ⇒ JobResponse

Get a job in an IotHub.

Get a job in an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • job_id (String)

    The job identifier.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1428
1429
1430
1431
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1428

def get_job(resource_group_name, resource_name, job_id, custom_headers = nil)
  response = get_job_async(resource_group_name, resource_name, job_id, custom_headers).value!
  response.body unless response.nil?
end

#get_job_async(resource_group_name, resource_name, job_id, custom_headers = nil) ⇒ Concurrent::Promise

Get a job in an IotHub.

Get a job in an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • job_id (String)

    The job identifier.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1463

def get_job_async(resource_group_name, resource_name, job_id, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'job_id is nil' if job_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'jobId' => job_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobResponse.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_job_with_http_info(resource_group_name, resource_name, job_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get a job in an IotHub.

Get a job in an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • job_id (String)

    The job identifier.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1446
1447
1448
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1446

def get_job_with_http_info(resource_group_name, resource_name, job_id, custom_headers = nil)
  get_job_async(resource_group_name, resource_name, job_id, custom_headers).value!
end

#get_keys_for_key_name(resource_group_name, resource_name, key_name, custom_headers = nil) ⇒ SharedAccessSignatureAuthorizationRule

Get the Key given a specific KeyName for an IotHub.

Get the Key given a specific KeyName for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • key_name (String)

    The name of the key.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1876
1877
1878
1879
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1876

def get_keys_for_key_name(resource_group_name, resource_name, key_name, custom_headers = nil)
  response = get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers).value!
  response.body unless response.nil?
end

#get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers = nil) ⇒ Concurrent::Promise

Get the Key given a specific KeyName for an IotHub.

Get the Key given a specific KeyName for an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • key_name (String)

    The name of the key.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1911

def get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'key_name is nil' if key_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'keyName' => key_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = SharedAccessSignatureAuthorizationRule.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_keys_for_key_name_with_http_info(resource_group_name, resource_name, key_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get the Key given a specific KeyName for an IotHub.

Get the Key given a specific KeyName for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • key_name (String)

    The name of the key.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1894
1895
1896
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1894

def get_keys_for_key_name_with_http_info(resource_group_name, resource_name, key_name, custom_headers = nil)
  get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers).value!
end

#get_quota_metrics(resource_group_name, resource_name, custom_headers = nil) ⇒ Array<IotHubQuotaMetricInfo>

Get quota metrics for an IotHub.

Get quota metrics for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1552
1553
1554
1555
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1552

def get_quota_metrics(resource_group_name, resource_name, custom_headers = nil)
  first_page = get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers)
  first_page.get_all_items
end

#get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers = nil) ⇒ IotHubQuotaMetricInfoListResult

Get quota metrics for an IotHub.

Get quota metrics for an IotHub.

will be added to the HTTP request.

of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1529

def get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers = nil)
  response = get_quota_metrics_async(resource_group_name, resource_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      get_quota_metrics_next_async(next_page_link, custom_headers)
    end
    page
  end
end

#get_quota_metrics_async(resource_group_name, resource_name, custom_headers = nil) ⇒ Concurrent::Promise

Get quota metrics for an IotHub.

Get quota metrics for an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1585

def get_quota_metrics_async(resource_group_name, resource_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubQuotaMetricInfoListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_quota_metrics_next(next_page_link, custom_headers = nil) ⇒ IotHubQuotaMetricInfoListResult

Get quota metrics for an IotHub.

Get quota metrics for an IotHub.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



2667
2668
2669
2670
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2667

def get_quota_metrics_next(next_page_link, custom_headers = nil)
  response = get_quota_metrics_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#get_quota_metrics_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Get quota metrics for an IotHub.

Get quota metrics for an IotHub.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2700

def get_quota_metrics_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubQuotaMetricInfoListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_quota_metrics_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get quota metrics for an IotHub.

Get quota metrics for an IotHub.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2684
2685
2686
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2684

def get_quota_metrics_next_with_http_info(next_page_link, custom_headers = nil)
  get_quota_metrics_next_async(next_page_link, custom_headers).value!
end

#get_quota_metrics_with_http_info(resource_group_name, resource_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get quota metrics for an IotHub.

Get quota metrics for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1569
1570
1571
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1569

def get_quota_metrics_with_http_info(resource_group_name, resource_name, custom_headers = nil)
  get_quota_metrics_async(resource_group_name, resource_name, custom_headers).value!
end

#get_stats(resource_group_name, resource_name, custom_headers = nil) ⇒ RegistryStatistics

Get IotHub Stats.

Get IotHub Stats.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



658
659
660
661
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 658

def get_stats(resource_group_name, resource_name, custom_headers = nil)
  response = get_stats_async(resource_group_name, resource_name, custom_headers).value!
  response.body unless response.nil?
end

#get_stats_async(resource_group_name, resource_name, custom_headers = nil) ⇒ Concurrent::Promise

Get IotHub Stats.

Get IotHub Stats.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 691

def get_stats_async(resource_group_name, resource_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = RegistryStatistics.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_stats_with_http_info(resource_group_name, resource_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get IotHub Stats.

Get IotHub Stats.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



675
676
677
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 675

def get_stats_with_http_info(resource_group_name, resource_name, custom_headers = nil)
  get_stats_async(resource_group_name, resource_name, custom_headers).value!
end

#get_valid_skus(resource_group_name, resource_name, custom_headers = nil) ⇒ Array<IotHubSkuDescription>

Get Valid Skus.

Get Valid Skus.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



779
780
781
782
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 779

def get_valid_skus(resource_group_name, resource_name, custom_headers = nil)
  first_page = get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers)
  first_page.get_all_items
end

#get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers = nil) ⇒ IotHubSkuDescriptionListResult

Get Valid Skus.

Get Valid Skus.

will be added to the HTTP request.

of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



756
757
758
759
760
761
762
763
764
765
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 756

def get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers = nil)
  response = get_valid_skus_async(resource_group_name, resource_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      get_valid_skus_next_async(next_page_link, custom_headers)
    end
    page
  end
end

#get_valid_skus_async(resource_group_name, resource_name, custom_headers = nil) ⇒ Concurrent::Promise

Get Valid Skus.

Get Valid Skus.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 812

def get_valid_skus_async(resource_group_name, resource_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubSkuDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_valid_skus_next(next_page_link, custom_headers = nil) ⇒ IotHubSkuDescriptionListResult

Get Valid Skus.

Get Valid Skus.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



2388
2389
2390
2391
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2388

def get_valid_skus_next(next_page_link, custom_headers = nil)
  response = get_valid_skus_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#get_valid_skus_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Get Valid Skus.

Get Valid Skus.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2421

def get_valid_skus_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubSkuDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_valid_skus_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get Valid Skus.

Get Valid Skus.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2405
2406
2407
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2405

def get_valid_skus_next_with_http_info(next_page_link, custom_headers = nil)
  get_valid_skus_next_async(next_page_link, custom_headers).value!
end

#get_valid_skus_with_http_info(resource_group_name, resource_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get Valid Skus.

Get Valid Skus.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



796
797
798
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 796

def get_valid_skus_with_http_info(resource_group_name, resource_name, custom_headers = nil)
  get_valid_skus_async(resource_group_name, resource_name, custom_headers).value!
end

#get_with_http_info(resource_group_name, resource_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get an IotHub.

Get an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



54
55
56
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 54

def get_with_http_info(resource_group_name, resource_name, custom_headers = nil)
  get_async(resource_group_name, resource_name, custom_headers).value!
end

#import_devices(resource_group_name, resource_name, import_devices_parameters, custom_headers = nil) ⇒ JobResponse

Import all the devices in an IotHub.

Import all the devices in an IotHub.

parameters. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • import_devices_parameters (ImportDevicesRequest)

    The import devices

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



2091
2092
2093
2094
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2091

def import_devices(resource_group_name, resource_name, import_devices_parameters, custom_headers = nil)
  response = import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers).value!
  response.body unless response.nil?
end

#import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers = nil) ⇒ Concurrent::Promise

Import all the devices in an IotHub.

Import all the devices in an IotHub.

parameters. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • import_devices_parameters (ImportDevicesRequest)

    The import devices

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2128

def import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'import_devices_parameters is nil' if import_devices_parameters.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = ImportDevicesRequest.mapper()
  request_content = @client.serialize(request_mapper,  import_devices_parameters, 'import_devices_parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobResponse.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#import_devices_with_http_info(resource_group_name, resource_name, import_devices_parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Import all the devices in an IotHub.

Import all the devices in an IotHub.

parameters. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • import_devices_parameters (ImportDevicesRequest)

    The import devices

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2110
2111
2112
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2110

def import_devices_with_http_info(resource_group_name, resource_name, import_devices_parameters, custom_headers = nil)
  import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers).value!
end

#list_by_resource_group(resource_group_name, custom_headers = nil) ⇒ Array<IotHubDescription>

Get all IotHubs in a Resourcegroup.

Get all IotHubs in a Resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



564
565
566
567
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 564

def list_by_resource_group(resource_group_name, custom_headers = nil)
  first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil) ⇒ IotHubDescriptionListResult

Get all IotHubs in a Resourcegroup.

Get all IotHubs in a Resource group.

will be added to the HTTP request.

the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



542
543
544
545
546
547
548
549
550
551
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 542

def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_next_async(next_page_link, custom_headers)
    end
    page
  end
end

#list_by_resource_group_async(resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Get all IotHubs in a Resourcegroup.

Get all IotHubs in a Resource group.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 595

def list_by_resource_group_async(resource_group_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_next(next_page_link, custom_headers = nil) ⇒ IotHubDescriptionListResult

Get all IotHubs in a Resourcegroup.

Get all IotHubs in a Resource group.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



2295
2296
2297
2298
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2295

def list_by_resource_group_next(next_page_link, custom_headers = nil)
  response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Get all IotHubs in a Resourcegroup.

Get all IotHubs in a Resource group.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2328

def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all IotHubs in a Resourcegroup.

Get all IotHubs in a Resource group.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2312
2313
2314
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2312

def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
  list_by_resource_group_next_async(next_page_link, custom_headers).value!
end

#list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all IotHubs in a Resourcegroup.

Get all IotHubs in a Resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



580
581
582
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 580

def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
  list_by_resource_group_async(resource_group_name, custom_headers).value!
end

#list_by_subscription(custom_headers = nil) ⇒ Array<IotHubDescription>

Get all IotHubs in a subscription.

Get all IotHubs in a subscription.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



451
452
453
454
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 451

def list_by_subscription(custom_headers = nil)
  first_page = list_by_subscription_as_lazy(custom_headers)
  first_page.get_all_items
end

#list_by_subscription_as_lazy(custom_headers = nil) ⇒ IotHubDescriptionListResult

Get all IotHubs in a subscription.

Get all IotHubs in a subscription.

will be added to the HTTP request.

the response.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



430
431
432
433
434
435
436
437
438
439
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 430

def list_by_subscription_as_lazy(custom_headers = nil)
  response = list_by_subscription_async(custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_subscription_next_async(next_page_link, custom_headers)
    end
    page
  end
end

#list_by_subscription_async(custom_headers = nil) ⇒ Concurrent::Promise

Get all IotHubs in a subscription.

Get all IotHubs in a subscription.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 480

def list_by_subscription_async(custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_subscription_next(next_page_link, custom_headers = nil) ⇒ IotHubDescriptionListResult

Get all IotHubs in a subscription.

Get all IotHubs in a subscription.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



2202
2203
2204
2205
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2202

def list_by_subscription_next(next_page_link, custom_headers = nil)
  response = list_by_subscription_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_by_subscription_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Get all IotHubs in a subscription.

Get all IotHubs in a subscription.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2235

def list_by_subscription_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = IotHubDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_subscription_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all IotHubs in a subscription.

Get all IotHubs in a subscription.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2219
2220
2221
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2219

def list_by_subscription_next_with_http_info(next_page_link, custom_headers = nil)
  list_by_subscription_next_async(next_page_link, custom_headers).value!
end

#list_by_subscription_with_http_info(custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all IotHubs in a subscription.

Get all IotHubs in a subscription.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



466
467
468
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 466

def list_by_subscription_with_http_info(custom_headers = nil)
  list_by_subscription_async(custom_headers).value!
end

#list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil) ⇒ Array<String>

Get EventHub Consumer Groups for an IotHub.

Get EventHub Consumer Groups for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<String>)

    operation results.



902
903
904
905
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 902

def list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil)
  first_page = list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers)
  first_page.get_all_items
end

#list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil) ⇒ EventHubConsumerGroupsListResult

Get EventHub Consumer Groups for an IotHub.

Get EventHub Consumer Groups for an IotHub.

will be added to the HTTP request.

pages of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



878
879
880
881
882
883
884
885
886
887
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 878

def list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil)
  response = list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_event_hub_consumer_groups_next_async(next_page_link, custom_headers)
    end
    page
  end
end

#list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil) ⇒ Concurrent::Promise

Get EventHub Consumer Groups for an IotHub.

Get EventHub Consumer Groups for an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 937

def list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = EventHubConsumerGroupsListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_event_hub_consumer_groups_next(next_page_link, custom_headers = nil) ⇒ EventHubConsumerGroupsListResult

Get EventHub Consumer Groups for an IotHub.

Get EventHub Consumer Groups for an IotHub.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



2481
2482
2483
2484
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2481

def list_event_hub_consumer_groups_next(next_page_link, custom_headers = nil)
  response = list_event_hub_consumer_groups_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_event_hub_consumer_groups_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Get EventHub Consumer Groups for an IotHub.

Get EventHub Consumer Groups for an IotHub.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2514

def list_event_hub_consumer_groups_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = EventHubConsumerGroupsListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_event_hub_consumer_groups_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get EventHub Consumer Groups for an IotHub.

Get EventHub Consumer Groups for an IotHub.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2498
2499
2500
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2498

def list_event_hub_consumer_groups_next_with_http_info(next_page_link, custom_headers = nil)
  list_event_hub_consumer_groups_next_async(next_page_link, custom_headers).value!
end

#list_event_hub_consumer_groups_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get EventHub Consumer Groups for an IotHub.

Get EventHub Consumer Groups for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • event_hub_endpoint_name (String)

    The name of the event hub endpoint.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



920
921
922
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 920

def list_event_hub_consumer_groups_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers = nil)
  list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers).value!
end

#list_jobs(resource_group_name, resource_name, custom_headers = nil) ⇒ Array<JobResponse>

Get all the jobs in an IotHub.

Get all the jobs in an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1330
1331
1332
1333
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1330

def list_jobs(resource_group_name, resource_name, custom_headers = nil)
  first_page = list_jobs_as_lazy(resource_group_name, resource_name, custom_headers)
  first_page.get_all_items
end

#list_jobs_as_lazy(resource_group_name, resource_name, custom_headers = nil) ⇒ JobResponseListResult

Get all the jobs in an IotHub.

Get all the jobs in an IotHub.

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1307

def list_jobs_as_lazy(resource_group_name, resource_name, custom_headers = nil)
  response = list_jobs_async(resource_group_name, resource_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_jobs_next_async(next_page_link, custom_headers)
    end
    page
  end
end

#list_jobs_async(resource_group_name, resource_name, custom_headers = nil) ⇒ Concurrent::Promise

Get all the jobs in an IotHub.

Get all the jobs in an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1363

def list_jobs_async(resource_group_name, resource_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobResponseListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_jobs_next(next_page_link, custom_headers = nil) ⇒ JobResponseListResult

Get all the jobs in an IotHub.

Get all the jobs in an IotHub.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



2574
2575
2576
2577
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2574

def list_jobs_next(next_page_link, custom_headers = nil)
  response = list_jobs_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_jobs_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Get all the jobs in an IotHub.

Get all the jobs in an IotHub.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2607

def list_jobs_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = JobResponseListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_jobs_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the jobs in an IotHub.

Get all the jobs in an IotHub.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2591
2592
2593
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2591

def list_jobs_next_with_http_info(next_page_link, custom_headers = nil)
  list_jobs_next_async(next_page_link, custom_headers).value!
end

#list_jobs_with_http_info(resource_group_name, resource_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the jobs in an IotHub.

Get all the jobs in an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1347
1348
1349
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1347

def list_jobs_with_http_info(resource_group_name, resource_name, custom_headers = nil)
  list_jobs_async(resource_group_name, resource_name, custom_headers).value!
end

#list_keys(resource_group_name, resource_name, custom_headers = nil) ⇒ Array<SharedAccessSignatureAuthorizationRule>

Get all keys for an IotHub.

Get all keys for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1778
1779
1780
1781
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1778

def list_keys(resource_group_name, resource_name, custom_headers = nil)
  first_page = list_keys_as_lazy(resource_group_name, resource_name, custom_headers)
  first_page.get_all_items
end

#list_keys_as_lazy(resource_group_name, resource_name, custom_headers = nil) ⇒ SharedAccessSignatureAuthorizationRuleListResult

Get all keys for an IotHub.

Get all keys for an IotHub.

will be added to the HTTP request.

lazy access to pages of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1755

def list_keys_as_lazy(resource_group_name, resource_name, custom_headers = nil)
  response = list_keys_async(resource_group_name, resource_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_keys_next_async(next_page_link, custom_headers)
    end
    page
  end
end

#list_keys_async(resource_group_name, resource_name, custom_headers = nil) ⇒ Concurrent::Promise

Get all keys for an IotHub.

Get all keys for an IotHub.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1811

def list_keys_async(resource_group_name, resource_name, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = SharedAccessSignatureAuthorizationRuleListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_keys_next(next_page_link, custom_headers = nil) ⇒ SharedAccessSignatureAuthorizationRuleListResult

Get all keys for an IotHub.

Get all keys for an IotHub.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



2760
2761
2762
2763
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2760

def list_keys_next(next_page_link, custom_headers = nil)
  response = list_keys_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_keys_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Get all keys for an IotHub.

Get all keys for an IotHub.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2793

def list_keys_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = SharedAccessSignatureAuthorizationRuleListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_keys_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all keys for an IotHub.

Get all keys for an IotHub.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2777
2778
2779
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2777

def list_keys_next_with_http_info(next_page_link, custom_headers = nil)
  list_keys_next_async(next_page_link, custom_headers).value!
end

#list_keys_with_http_info(resource_group_name, resource_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all keys for an IotHub.

Get all keys for an IotHub.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_name (String)

    The name of the resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1795
1796
1797
# File 'lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1795

def list_keys_with_http_info(resource_group_name, resource_name, custom_headers = nil)
  list_keys_async(resource_group_name, resource_name, custom_headers).value!
end