Class: Azure::IotHub::Mgmt::V2018_12_01_preview::IotHubResource

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb

Overview

Use this API to manage the IoT hubs in your Azure subscription.

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.



17
18
19
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientIotHubClient (readonly)

Returns reference to the IotHubClient.

Returns:



22
23
24
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 22

def client
  @client
end

Instance Method Details

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

Create or update the metadata of an IoT hub.

Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub.

contains the IoT hub. security metadata. brand new IoT Hub. Required to update an existing IoT Hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • iot_hub_description (IotHubDescription)

    The IoT hub metadata and

  • if_match (String) (defaults to: nil)

    ETag of the IoT Hub. Do not specify for creating a

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

    A hash of custom headers that

Returns:

  • (IotHubDescription)

    operation results.



2387
2388
2389
2390
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2387

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

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

Create or update the metadata of an IoT hub.

Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub.

contains the IoT hub. security metadata. brand new IoT Hub. Required to update an existing IoT Hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • iot_hub_description (IotHubDescription)

    The IoT hub metadata and

  • if_match (String) (defaults to: nil)

    ETag of the IoT Hub. Do not specify for creating a

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2434

def begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:nil, 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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

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

  # Serialize Request
  request_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescription.mapper()
  request_content = @client.serialize(request_mapper,  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 || 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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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, if_match: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create or update the metadata of an IoT hub.

Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub.

contains the IoT hub. security metadata. brand new IoT Hub. Required to update an existing IoT Hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • iot_hub_description (IotHubDescription)

    The IoT hub metadata and

  • if_match (String) (defaults to: nil)

    ETag of the IoT Hub. Do not specify for creating a

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2411
2412
2413
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2411

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

#begin_delete(resource_group_name, resource_name, custom_headers: nil) ⇒ Object

Delete an IoT hub

Delete an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



2638
2639
2640
2641
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2638

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

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

Delete an IoT hub

Delete an IoT hub.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
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/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2673

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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 || status_code == 200 || status_code == 204 || status_code == 404
      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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 404
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::ErrorDetails.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 IoT hub

Delete an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2656
2657
2658
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2656

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

#begin_update(resource_group_name, resource_name, iot_hub_tags, custom_headers: nil) ⇒ IotHubDescription

Update an existing IoT Hubs tags.

Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method

iot hub instance. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group identifier.

  • resource_name (String)

    Name of iot hub to update.

  • iot_hub_tags (TagsResource)

    Updated tag information to set into the

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

    A hash of custom headers that

Returns:

  • (IotHubDescription)

    operation results.



2523
2524
2525
2526
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2523

def begin_update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
  response = begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers: nil) ⇒ Concurrent::Promise

Update an existing IoT Hubs tags.

Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method

iot hub instance. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group identifier.

  • resource_name (String)

    Name of iot hub to update.

  • iot_hub_tags (TagsResource)

    Updated tag information to set into the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2562

def begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers: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_tags is nil' if iot_hub_tags.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::TagsResource.mapper()
  request_content = @client.serialize(request_mapper,  iot_hub_tags)
  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(:patch, 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 MsRestAzure::AzureOperationError.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_update_with_http_info(resource_group_name, resource_name, iot_hub_tags, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Update an existing IoT Hubs tags.

Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method

iot hub instance. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group identifier.

  • resource_name (String)

    Name of iot hub to update.

  • iot_hub_tags (TagsResource)

    Updated tag information to set into the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2543
2544
2545
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2543

def begin_update_with_http_info(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
  begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
end

#check_name_availability(operation_inputs, custom_headers: nil) ⇒ IotHubNameAvailabilityInfo

Check if an IoT hub name is available

Check if an IoT hub name is available.

OperationInputs structure to the name of the IoT hub to check. will be added to the HTTP request.

Parameters:

  • operation_inputs (OperationInputs)

    Set the name parameter in the

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

    A hash of custom headers that

Returns:

  • (IotHubNameAvailabilityInfo)

    operation results.



1572
1573
1574
1575
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1572

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

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

Check if an IoT hub name is available

Check if an IoT hub name is available.

OperationInputs structure to the name of the IoT hub to check. to the HTTP request.

Parameters:

  • operation_inputs (OperationInputs)

    Set the name parameter in the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1605

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

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

  # Serialize Request
  request_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::OperationInputs.mapper()
  request_content = @client.serialize(request_mapper,  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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubNameAvailabilityInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 IoT hub name is available

Check if an IoT hub name is available.

OperationInputs structure to the name of the IoT hub to check. will be added to the HTTP request.

Parameters:

  • operation_inputs (OperationInputs)

    Set the name parameter in the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1589
1590
1591
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1589

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

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

Add a consumer group to an Event Hub-compatible endpoint in an IoT hub

Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.

contains the IoT hub. endpoint in the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • name (String)

    The name of the consumer group to add.

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

    A hash of custom headers that

Returns:

  • (EventHubConsumerGroupInfo)

    operation results.



934
935
936
937
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 934

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: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 a consumer group to an Event Hub-compatible endpoint in an IoT hub

Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.

contains the IoT hub. endpoint in the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • name (String)

    The name of the consumer group to add.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 975

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::EventHubConsumerGroupInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 a consumer group to an Event Hub-compatible endpoint in an IoT hub

Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.

contains the IoT hub. endpoint in the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • name (String)

    The name of the consumer group to add.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



955
956
957
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 955

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:custom_headers).value!
end

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

Create or update the metadata of an IoT hub.

Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub.

contains the IoT hub. security metadata. brand new IoT Hub. Required to update an existing IoT Hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • iot_hub_description (IotHubDescription)

    The IoT hub metadata and

  • if_match (String) (defaults to: nil)

    ETag of the IoT Hub. Do not specify for creating a

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

    A hash of custom headers that

Returns:

  • (IotHubDescription)

    operation results.



146
147
148
149
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 146

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

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

contains the IoT hub. security metadata. brand new IoT Hub. Required to update an existing IoT Hub. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • iot_hub_description (IotHubDescription)

    The IoT hub metadata and

  • if_match (String) (defaults to: nil)

    ETag of the IoT Hub. Do not specify for creating a

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 165

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

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescription.mapper()
      parsed_response = @client.deserialize(result_mapper, 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) ⇒ Object

Delete an IoT hub

Delete an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



245
246
247
248
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 245

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

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

contains the IoT hub. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 260

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

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = {
        client_side_validation: true,
        required: false,
        serialized_name: 'parsed_response',
        type: {
          name: 'Object'
        }
      }
      parsed_response = @client.deserialize(result_mapper, 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 a consumer group from an Event Hub-compatible endpoint in an IoT hub

Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.

contains the IoT hub. endpoint in the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • name (String)

    The name of the consumer group to delete.

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

    A hash of custom headers that



1047
1048
1049
1050
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1047

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: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 a consumer group from an Event Hub-compatible endpoint in an IoT hub

Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.

contains the IoT hub. endpoint in the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • name (String)

    The name of the consumer group to delete.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1088

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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 a consumer group from an Event Hub-compatible endpoint in an IoT hub

Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.

contains the IoT hub. endpoint in the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • name (String)

    The name of the consumer group to delete.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1068
1069
1070
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1068

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:custom_headers).value!
end

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

Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities

Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.

contains the IoT hub. specify the export devices operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • export_devices_parameters (ExportDevicesRequest)

    The parameters that

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

    A hash of custom headers that

Returns:

  • (JobResponse)

    operation results.



2129
2130
2131
2132
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2129

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: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

Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities

Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.

contains the IoT hub. specify the export devices operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • export_devices_parameters (ExportDevicesRequest)

    The parameters that

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2176

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

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

  # Serialize Request
  request_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::ExportDevicesRequest.mapper()
  request_content = @client.serialize(request_mapper,  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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::JobResponse.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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

Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities

Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.

contains the IoT hub. specify the export devices operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • export_devices_parameters (ExportDevicesRequest)

    The parameters that

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2153
2154
2155
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2153

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:custom_headers).value!
end

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

Get the non-security related metadata of an IoT hub

Get the non-security related metadata of an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (IotHubDescription)

    operation results.



37
38
39
40
# File 'lib/2018-12-01-preview/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:custom_headers).value!
  response.body unless response.nil?
end

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

Get the non-security related metadata of an IoT hub

Get the non-security related metadata of an IoT hub.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
121
122
123
124
125
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 72

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_endpoint_health(resource_group_name, iot_hub_name, custom_headers: nil) ⇒ Array<EndpointHealthData>

Get the health for routing endpoints

Get the health for routing endpoints.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<EndpointHealthData>)

    operation results.



1472
1473
1474
1475
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1472

def get_endpoint_health(resource_group_name, iot_hub_name, custom_headers:nil)
  first_page = get_endpoint_health_as_lazy(resource_group_name, iot_hub_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#get_endpoint_health_as_lazy(resource_group_name, iot_hub_name, custom_headers: nil) ⇒ EndpointHealthDataListResult

Get the health for routing endpoints

Get the health for routing endpoints.

will be added to the HTTP request.

the response.

Parameters:

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

    A hash of custom headers that

Returns:

  • (EndpointHealthDataListResult)

    which provide lazy access to pages of



3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3699

def get_endpoint_health_as_lazy(resource_group_name, iot_hub_name, custom_headers:nil)
  response = get_endpoint_health_async(resource_group_name, iot_hub_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      get_endpoint_health_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#get_endpoint_health_async(resource_group_name, iot_hub_name, custom_headers: nil) ⇒ Concurrent::Promise

Get the health for routing endpoints

Get the health for routing endpoints.

to the HTTP request.

Parameters:

  • resource_group_name (String)
  • iot_hub_name (String)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1505

def get_endpoint_health_async(resource_group_name, iot_hub_name, custom_headers: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, 'iot_hub_name is nil' if iot_hub_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # 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/{iotHubName}/routingEndpointsHealth'

  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,'iotHubName' => iot_hub_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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::EndpointHealthDataListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_endpoint_health_next(next_page_link, custom_headers: nil) ⇒ EndpointHealthDataListResult

Get the health for routing endpoints

Get the health for routing endpoints.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (EndpointHealthDataListResult)

    operation results.



3348
3349
3350
3351
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3348

def get_endpoint_health_next(next_page_link, custom_headers:nil)
  response = get_endpoint_health_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_endpoint_health_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Get the health for routing endpoints

Get the health for routing endpoints.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3381

def get_endpoint_health_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::EndpointHealthDataListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_endpoint_health_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get the health for routing endpoints

Get the health for routing endpoints.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3365
3366
3367
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3365

def get_endpoint_health_next_with_http_info(next_page_link, custom_headers:nil)
  get_endpoint_health_next_async(next_page_link, custom_headers:custom_headers).value!
end

#get_endpoint_health_with_http_info(resource_group_name, iot_hub_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get the health for routing endpoints

Get the health for routing endpoints.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1489
1490
1491
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1489

def get_endpoint_health_with_http_info(resource_group_name, iot_hub_name, custom_headers:nil)
  get_endpoint_health_async(resource_group_name, iot_hub_name, custom_headers:custom_headers).value!
end

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

Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub

Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub.

contains the IoT hub. endpoint in the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • name (String)

    The name of the consumer group to retrieve.

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

    A hash of custom headers that

Returns:

  • (EventHubConsumerGroupInfo)

    operation results.



816
817
818
819
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 816

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: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 a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub

Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub.

contains the IoT hub. endpoint in the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • name (String)

    The name of the consumer group to retrieve.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 861

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::EventHubConsumerGroupInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub

Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub.

contains the IoT hub. endpoint in the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • name (String)

    The name of the consumer group to retrieve.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



839
840
841
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 839

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:custom_headers).value!
end

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

Get the details of a job from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get the details of a job from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • job_id (String)

    The job identifier.

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

    A hash of custom headers that

Returns:

  • (JobResponse)

    operation results.



1260
1261
1262
1263
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1260

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: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 the details of a job from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get the details of a job from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • 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.



1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1301

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::JobResponse.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the details of a job from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get the details of a job from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • 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.



1281
1282
1283
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1281

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:custom_headers).value!
end

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

Get a shared access policy by name from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get a shared access policy by name from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • key_name (String)

    The name of the shared access policy.

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

    A hash of custom headers that

Returns:

  • (SharedAccessSignatureAuthorizationRule)

    operation results.



2013
2014
2015
2016
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2013

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: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 a shared access policy by name from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get a shared access policy by name from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • key_name (String)

    The name of the shared access policy.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2054

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::SharedAccessSignatureAuthorizationRule.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 a shared access policy by name from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get a shared access policy by name from an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • key_name (String)

    The name of the shared access policy.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2034
2035
2036
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2034

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:custom_headers).value!
end

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

Get the quota metrics for an IoT hub

Get the quota metrics for an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (Array<IotHubQuotaMetricInfo>)

    operation results.



1370
1371
1372
1373
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1370

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:custom_headers)
  first_page.get_all_items
end

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

Get the quota metrics for an IoT hub

Get the quota metrics for an IoT hub.

contains the IoT hub. will be added to the HTTP request.

of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (IotHubQuotaMetricInfoListResult)

    which provide lazy access to pages



3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3675

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: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:custom_headers)
    end
    page
  end
end

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

Get the quota metrics for an IoT hub

Get the quota metrics for an IoT hub.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1405

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubQuotaMetricInfoListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the quota metrics for an IoT hub

Get the quota metrics for an IoT hub.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (IotHubQuotaMetricInfoListResult)

    operation results.



3252
3253
3254
3255
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3252

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

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

Get the quota metrics for an IoT hub

Get the quota metrics for an IoT hub.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3285

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubQuotaMetricInfoListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the quota metrics for an IoT hub

Get the quota metrics for an IoT hub.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3269
3270
3271
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3269

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

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

Get the quota metrics for an IoT hub

Get the quota metrics for an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1388
1389
1390
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1388

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:custom_headers).value!
end

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

Get the statistics from an IoT hub

Get the statistics from an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (RegistryStatistics)

    operation results.



489
490
491
492
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 489

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

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

Get the statistics from an IoT hub

Get the statistics from an IoT hub.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 524

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::RegistryStatistics.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the statistics from an IoT hub

Get the statistics from an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



507
508
509
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 507

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

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

Get the list of valid SKUs for an IoT hub

Get the list of valid SKUs for an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (Array<IotHubSkuDescription>)

    operation results.



592
593
594
595
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 592

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:custom_headers)
  first_page.get_all_items
end

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

Get the list of valid SKUs for an IoT hub

Get the list of valid SKUs for an IoT hub.

contains the IoT hub. will be added to the HTTP request.

of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (IotHubSkuDescriptionListResult)

    which provide lazy access to pages



3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3594

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: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:custom_headers)
    end
    page
  end
end

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

Get the list of valid SKUs for an IoT hub

Get the list of valid SKUs for an IoT hub.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 627

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubSkuDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the list of valid SKUs for an IoT hub

Get the list of valid SKUs for an IoT hub.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (IotHubSkuDescriptionListResult)

    operation results.



2952
2953
2954
2955
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2952

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

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

Get the list of valid SKUs for an IoT hub

Get the list of valid SKUs for an IoT hub.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2985

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubSkuDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the list of valid SKUs for an IoT hub

Get the list of valid SKUs for an IoT hub.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2969
2970
2971
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2969

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

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

Get the list of valid SKUs for an IoT hub

Get the list of valid SKUs for an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



610
611
612
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 610

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:custom_headers).value!
end

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

Get the non-security related metadata of an IoT hub

Get the non-security related metadata of an IoT hub.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



55
56
57
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 55

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

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

Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities

Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.

contains the IoT hub. specify the import devices operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • import_devices_parameters (ImportDevicesRequest)

    The parameters that

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

    A hash of custom headers that

Returns:

  • (JobResponse)

    operation results.



2258
2259
2260
2261
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2258

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: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, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities

Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.

contains the IoT hub. specify the import devices operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • import_devices_parameters (ImportDevicesRequest)

    The parameters that

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
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
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2305

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

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

  # Serialize Request
  request_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::ImportDevicesRequest.mapper()
  request_content = @client.serialize(request_mapper,  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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::JobResponse.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities

Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.

contains the IoT hub. specify the import devices operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • import_devices_parameters (ImportDevicesRequest)

    The parameters that

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2282
2283
2284
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2282

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:custom_headers).value!
end

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

Get all the IoT hubs in a resource group

Get all the IoT hubs in a resource group.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

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

    A hash of custom headers that

Returns:

  • (Array<IotHubDescription>)

    operation results.



389
390
391
392
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 389

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

#list_by_resource_group_as_lazy(resource_group_name, custom_headers: nil) ⇒ IotHubDescriptionListResult

Get all the IoT hubs in a resource group

Get all the IoT hubs in a resource group.

contains the IoT hub. will be added to the HTTP request.

the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

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

    A hash of custom headers that

Returns:

  • (IotHubDescriptionListResult)

    which provide lazy access to pages of



3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3569

def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers: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:custom_headers)
    end
    page
  end
end

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

Get all the IoT hubs in a resource group

Get all the IoT hubs in a resource group.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 422

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the IoT hubs in a resource group

Get all the IoT hubs in a resource group.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (IotHubDescriptionListResult)

    operation results.



2856
2857
2858
2859
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2856

def list_by_resource_group_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_next_async(next_page_link, custom_headers: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 the IoT hubs in a resource group

Get all the IoT hubs in a resource group.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2889

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the IoT hubs in a resource group

Get all the IoT hubs in a resource group.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2873
2874
2875
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2873

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:custom_headers).value!
end

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

Get all the IoT hubs in a resource group

Get all the IoT hubs in a resource group.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



406
407
408
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 406

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

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

Get all the IoT hubs in a subscription

Get all the IoT hubs 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:

  • (Array<IotHubDescription>)

    operation results.



295
296
297
298
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 295

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

#list_by_subscription_as_lazy(custom_headers: nil) ⇒ IotHubDescriptionListResult

Get all the IoT hubs in a subscription

Get all the IoT hubs 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:

  • (IotHubDescriptionListResult)

    which provide lazy access to pages of



3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3545

def list_by_subscription_as_lazy(custom_headers:nil)
  response = list_by_subscription_async(custom_headers: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:custom_headers)
    end
    page
  end
end

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

Get all the IoT hubs in a subscription

Get all the IoT hubs 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.



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 324

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the IoT hubs in a subscription

Get all the IoT hubs in a subscription.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (IotHubDescriptionListResult)

    operation results.



2760
2761
2762
2763
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2760

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

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

Get all the IoT hubs in a subscription

Get all the IoT hubs in a subscription.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • 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
2840
2841
2842
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2793

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescriptionListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the IoT hubs in a subscription

Get all the IoT hubs in a subscription.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • 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/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 2777

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

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

Get all the IoT hubs in a subscription

Get all the IoT hubs 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.



310
311
312
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 310

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

#list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers: nil) ⇒ Array<EventHubConsumerGroupInfo>

Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub

Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub.

contains the IoT hub. endpoint. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

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

    A hash of custom headers that

Returns:

  • (Array<EventHubConsumerGroupInfo>)

    operation results.



699
700
701
702
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 699

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: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 a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub

Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub.

contains the IoT hub. endpoint. will be added to the HTTP request.

of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

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

    A hash of custom headers that

Returns:

  • (EventHubConsumerGroupsListResult)

    which provide lazy access to pages



3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3623

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: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: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 a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub

Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub.

contains the IoT hub. endpoint. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 742

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::EventHubConsumerGroupsListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub

Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (EventHubConsumerGroupsListResult)

    operation results.



3050
3051
3052
3053
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3050

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: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 a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub

Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3087

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::EventHubConsumerGroupsListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub

Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3069
3070
3071
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3069

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: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 a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub

Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub.

contains the IoT hub. endpoint. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • event_hub_endpoint_name (String)

    The name of the Event Hub-compatible

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



721
722
723
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 721

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:custom_headers).value!
end

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

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (Array<JobResponse>)

    operation results.



1150
1151
1152
1153
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1150

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

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

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

contains the IoT hub. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (JobResponseListResult)

    which provide lazy access to pages of the



3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3650

def list_jobs_as_lazy(resource_group_name, resource_name, custom_headers:nil)
  response = list_jobs_async(resource_group_name, resource_name, custom_headers: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:custom_headers)
    end
    page
  end
end

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

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1189

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::JobResponseListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (JobResponseListResult)

    operation results.



3152
3153
3154
3155
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3152

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

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

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3189

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::JobResponseListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3171
3172
3173
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3171

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

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

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry

Get a list of all the jobs in an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1170
1171
1172
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1170

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

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

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (Array<SharedAccessSignatureAuthorizationRule>)

    operation results.



1903
1904
1905
1906
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1903

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

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

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

contains the IoT hub. will be added to the HTTP request.

access to pages of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (SharedAccessSignatureAuthorizationRuleListResult)

    which provide lazy



3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3726

def list_keys_as_lazy(resource_group_name, resource_name, custom_headers:nil)
  response = list_keys_async(resource_group_name, resource_name, custom_headers: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:custom_headers)
    end
    page
  end
end

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

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

contains the IoT hub. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1942

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::SharedAccessSignatureAuthorizationRuleListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (SharedAccessSignatureAuthorizationRuleListResult)

    operation results.



3446
3447
3448
3449
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3446

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

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

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3483

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::SharedAccessSignatureAuthorizationRuleListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3465
3466
3467
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 3465

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

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

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security

Get the security metadata for an IoT hub. For more information, see: docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.

contains the IoT hub. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • resource_name (String)

    The name of the IoT hub.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1923
1924
1925
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1923

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

#test_all_routes(input, iot_hub_name, resource_group_name, custom_headers: nil) ⇒ TestAllRoutesResult

Test all routes

Test all routes configured in this Iot Hub

will be added to the HTTP request.

Parameters:

  • input (TestAllRoutesInput)

    Input for testing all routes

  • iot_hub_name (String)

    IotHub to be tested

  • resource_group_name (String)

    resource group which Iot Hub belongs to

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

    A hash of custom headers that

Returns:

  • (TestAllRoutesResult)

    operation results.



1679
1680
1681
1682
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1679

def test_all_routes(input, iot_hub_name, resource_group_name, custom_headers:nil)
  response = test_all_routes_async(input, iot_hub_name, resource_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#test_all_routes_async(input, iot_hub_name, resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Test all routes

Test all routes configured in this Iot Hub

to the HTTP request.

Parameters:

  • input (TestAllRoutesInput)

    Input for testing all routes

  • iot_hub_name (String)

    IotHub to be tested

  • resource_group_name (String)

    resource group which Iot Hub belongs to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1714

def test_all_routes_async(input, iot_hub_name, resource_group_name, custom_headers:nil)
  fail ArgumentError, 'input is nil' if input.nil?
  fail ArgumentError, 'iot_hub_name is nil' if iot_hub_name.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, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::TestAllRoutesInput.mapper()
  request_content = @client.serialize(request_mapper,  input)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'iotHubName' => iot_hub_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::TestAllRoutesResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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

#test_all_routes_with_http_info(input, iot_hub_name, resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Test all routes

Test all routes configured in this Iot Hub

will be added to the HTTP request.

Parameters:

  • input (TestAllRoutesInput)

    Input for testing all routes

  • iot_hub_name (String)

    IotHub to be tested

  • resource_group_name (String)

    resource group which Iot Hub belongs to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1697
1698
1699
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1697

def test_all_routes_with_http_info(input, iot_hub_name, resource_group_name, custom_headers:nil)
  test_all_routes_async(input, iot_hub_name, resource_group_name, custom_headers:custom_headers).value!
end

#test_route(input, iot_hub_name, resource_group_name, custom_headers: nil) ⇒ TestRouteResult

Test the new route

Test the new route for this Iot Hub

will be added to the HTTP request.

Parameters:

  • input (TestRouteInput)

    Route that needs to be tested

  • iot_hub_name (String)

    IotHub to be tested

  • resource_group_name (String)

    resource group which Iot Hub belongs to

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

    A hash of custom headers that

Returns:

  • (TestRouteResult)

    operation results.



1790
1791
1792
1793
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1790

def test_route(input, iot_hub_name, resource_group_name, custom_headers:nil)
  response = test_route_async(input, iot_hub_name, resource_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#test_route_async(input, iot_hub_name, resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Test the new route

Test the new route for this Iot Hub

to the HTTP request.

Parameters:

  • input (TestRouteInput)

    Route that needs to be tested

  • iot_hub_name (String)

    IotHub to be tested

  • resource_group_name (String)

    resource group which Iot Hub belongs to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1825

def test_route_async(input, iot_hub_name, resource_group_name, custom_headers:nil)
  fail ArgumentError, 'input is nil' if input.nil?
  fail ArgumentError, 'iot_hub_name is nil' if iot_hub_name.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, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::TestRouteInput.mapper()
  request_content = @client.serialize(request_mapper,  input)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'iotHubName' => iot_hub_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::TestRouteResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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

#test_route_with_http_info(input, iot_hub_name, resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Test the new route

Test the new route for this Iot Hub

will be added to the HTTP request.

Parameters:

  • input (TestRouteInput)

    Route that needs to be tested

  • iot_hub_name (String)

    IotHub to be tested

  • resource_group_name (String)

    resource group which Iot Hub belongs to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1808
1809
1810
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 1808

def test_route_with_http_info(input, iot_hub_name, resource_group_name, custom_headers:nil)
  test_route_async(input, iot_hub_name, resource_group_name, custom_headers:custom_headers).value!
end

#update(resource_group_name, resource_name, iot_hub_tags, custom_headers: nil) ⇒ IotHubDescription

Update an existing IoT Hubs tags.

Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method

iot hub instance. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group identifier.

  • resource_name (String)

    Name of iot hub to update.

  • iot_hub_tags (TagsResource)

    Updated tag information to set into the

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

    A hash of custom headers that

Returns:

  • (IotHubDescription)

    operation results.



198
199
200
201
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 198

def update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
  response = update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers: nil) ⇒ Concurrent::Promise

iot hub instance. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Resource group identifier.

  • resource_name (String)

    Name of iot hub to update.

  • iot_hub_tags (TagsResource)

    Updated tag information to set into the

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/2018-12-01-preview/generated/azure_mgmt_iot_hub/iot_hub_resource.rb', line 214

def update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::IotHub::Mgmt::V2018_12_01_preview::Models::IotHubDescription.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

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

  promise
end