class Azure::IotHub::Mgmt::V2017_01_19::IotHubResource

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

Attributes

client[R]

@return [IotHubClient] reference to the IotHubClient

Public Class Methods

new(client) click to toggle source

Creates and initializes a new instance of the IotHubResource class. @param client service class for accessing basic functionality.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 17
def initialize(client)
  @client = client
end

Public Instance Methods

begin_create_or_update(resource_group_name, resource_name, iot_hub_description, custom_headers:nil) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to create or update. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubDescription] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2010
def begin_create_or_update(resource_group_name, resource_name, iot_hub_description, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers:nil) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to create or update. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2053
def begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'iot_hub_description is nil' if iot_hub_description.nil?


  request_headers = {}
  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::V2017_01_19::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::V2017_01_19::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::V2017_01_19::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, custom_headers:nil) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to create or update. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2032
def begin_create_or_update_with_http_info(resource_group_name, resource_name, iot_hub_description, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers:custom_headers).value!
end
begin_delete(resource_group_name, resource_name, custom_headers:nil) click to toggle source

Delete an IoT hub.

Delete an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to delete. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Object] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2139
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) click to toggle source

Delete an IoT hub.

Delete an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to delete. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2174
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::V2017_01_19::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::V2017_01_19::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::V2017_01_19::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) click to toggle source

Delete an IoT hub.

Delete an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to delete. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2157
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
check_name_availability(operation_inputs, custom_headers:nil) click to toggle source

Check if an IoT hub name is available.

Check if an IoT hub name is available.

@param operation_inputs [OperationInputs] Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubNameAvailabilityInfo] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1419
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) click to toggle source

Check if an IoT hub name is available.

Check if an IoT hub name is available.

@param operation_inputs [OperationInputs] Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1452
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::V2017_01_19::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::V2017_01_19::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) click to toggle source

Check if an IoT hub name is available.

Check if an IoT hub name is available.

@param operation_inputs [OperationInputs] Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1436
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint in the IoT hub. @param name [String] The name of the consumer group to add. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventHubConsumerGroupInfo] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 881
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint in the IoT hub. @param name [String] The name of the consumer group to add. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 922
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::V2017_01_19::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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint in the IoT hub. @param name [String] The name of the consumer group to add. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 902
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, custom_headers:nil) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to create or update. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubDescription] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 144
def create_or_update(resource_group_name, resource_name, iot_hub_description, custom_headers:nil)
  response = create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to create or update. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 161
def create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::IotHub::Mgmt::V2017_01_19::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) click to toggle source

Delete an IoT hub.

Delete an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to delete. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Object] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 192
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) click to toggle source

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub to delete. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 207
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint in the IoT hub. @param name [String] The name of the consumer group to delete. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 994
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint in the IoT hub. @param name [String] The name of the consumer group to delete. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1035
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint in the IoT hub. @param name [String] The name of the consumer group to delete. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1015
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param export_devices_parameters [ExportDevicesRequest] The parameters that specify the export devices operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResponse] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1754
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param export_devices_parameters [ExportDevicesRequest] The parameters that specify the export devices operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1801
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::V2017_01_19::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::V2017_01_19::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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param export_devices_parameters [ExportDevicesRequest] The parameters that specify the export devices operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1778
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) click to toggle source

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

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

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubDescription] operation results.

# File lib/2017-01-19/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) click to toggle source

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

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

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/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::V2017_01_19::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_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint in the IoT hub. @param name [String] The name of the consumer group to retrieve. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventHubConsumerGroupInfo] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 763
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint in the IoT hub. @param name [String] The name of the consumer group to retrieve. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 808
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::V2017_01_19::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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint in the IoT hub. @param name [String] The name of the consumer group to retrieve. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 786
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param job_id [String] The job identifier. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResponse] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1207
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param job_id [String] The job identifier. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1248
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::V2017_01_19::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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param job_id [String] The job identifier. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1228
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param key_name [String] The name of the shared access policy. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SharedAccessSignatureAuthorizationRule] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1638
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param key_name [String] The name of the shared access policy. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1679
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::V2017_01_19::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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param key_name [String] The name of the shared access policy. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1659
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) click to toggle source

Get the quota metrics for an IoT hub.

Get the quota metrics for an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<IotHubQuotaMetricInfo>] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1317
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) click to toggle source

Get the quota metrics for an IoT hub.

Get the quota metrics for an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubQuotaMetricInfoListResult] which provide lazy access to pages of the response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3080
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) click to toggle source

Get the quota metrics for an IoT hub.

Get the quota metrics for an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1352
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::V2017_01_19::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) click to toggle source

Get the quota metrics for an IoT hub.

Get the quota metrics for an IoT hub.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubQuotaMetricInfoListResult] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2753
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) click to toggle source

Get the quota metrics for an IoT hub.

Get the quota metrics for an IoT hub.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2786
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::V2017_01_19::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) click to toggle source

Get the quota metrics for an IoT hub.

Get the quota metrics for an IoT hub.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2770
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) click to toggle source

Get the quota metrics for an IoT hub.

Get the quota metrics for an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1335
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) click to toggle source

Get the statistics from an IoT hub.

Get the statistics from an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [RegistryStatistics] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 436
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) click to toggle source

Get the statistics from an IoT hub.

Get the statistics from an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 471
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::V2017_01_19::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) click to toggle source

Get the statistics from an IoT hub.

Get the statistics from an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 454
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) click to toggle source

Get the list of valid SKUs for an IoT hub.

Get the list of valid SKUs for an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<IotHubSkuDescription>] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 539
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) click to toggle source

Get the list of valid SKUs for an IoT hub.

Get the list of valid SKUs for an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubSkuDescriptionListResult] which provide lazy access to pages of the response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2999
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) click to toggle source

Get the list of valid SKUs for an IoT hub.

Get the list of valid SKUs for an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 574
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::V2017_01_19::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) click to toggle source

Get the list of valid SKUs for an IoT hub.

Get the list of valid SKUs for an IoT hub.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubSkuDescriptionListResult] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2453
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) click to toggle source

Get the list of valid SKUs for an IoT hub.

Get the list of valid SKUs for an IoT hub.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2486
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::V2017_01_19::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) click to toggle source

Get the list of valid SKUs for an IoT hub.

Get the list of valid SKUs for an IoT hub.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2470
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) click to toggle source

Get the list of valid SKUs for an IoT hub.

Get the list of valid SKUs for an IoT hub.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 557
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) click to toggle source

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

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

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param import_devices_parameters [ImportDevicesRequest] The parameters that specify the import devices operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResponse] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1883
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param import_devices_parameters [ImportDevicesRequest] The parameters that specify the import devices operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1930
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::V2017_01_19::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::V2017_01_19::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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param import_devices_parameters [ImportDevicesRequest] The parameters that specify the import devices operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1907
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) click to toggle source

Get all the IoT hubs in a resource group.

Get all the IoT hubs in a resource group.

@param resource_group_name [String] The name of the resource group that contains the IoT hubs. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<IotHubDescription>] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 336
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) click to toggle source

Get all the IoT hubs in a resource group.

Get all the IoT hubs in a resource group.

@param resource_group_name [String] The name of the resource group that contains the IoT hubs. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubDescriptionListResult] which provide lazy access to pages of the response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2974
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) click to toggle source

Get all the IoT hubs in a resource group.

Get all the IoT hubs in a resource group.

@param resource_group_name [String] The name of the resource group that contains the IoT hubs. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 369
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::V2017_01_19::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) click to toggle source

Get all the IoT hubs in a resource group.

Get all the IoT hubs in a resource group.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubDescriptionListResult] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2357
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) click to toggle source

Get all the IoT hubs in a resource group.

Get all the IoT hubs in a resource group.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2390
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::V2017_01_19::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) click to toggle source

Get all the IoT hubs in a resource group.

Get all the IoT hubs in a resource group.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2374
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) click to toggle source

Get all the IoT hubs in a resource group.

Get all the IoT hubs in a resource group.

@param resource_group_name [String] The name of the resource group that contains the IoT hubs. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 353
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) click to toggle source

Get all the IoT hubs in a subscription.

Get all the IoT hubs in a subscription.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<IotHubDescription>] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 242
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) click to toggle source

Get all the IoT hubs in a subscription.

Get all the IoT hubs in a subscription.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubDescriptionListResult] which provide lazy access to pages of the response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2950
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) click to toggle source

Get all the IoT hubs in a subscription.

Get all the IoT hubs in a subscription.

@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 271
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::V2017_01_19::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) click to toggle source

Get all the IoT hubs in a subscription.

Get all the IoT hubs in a subscription.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IotHubDescriptionListResult] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2261
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) click to toggle source

Get all the IoT hubs in a subscription.

Get all the IoT hubs in a subscription.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2294
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::V2017_01_19::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) click to toggle source

Get all the IoT hubs in a subscription.

Get all the IoT hubs in a subscription.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2278
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) click to toggle source

Get all the IoT hubs in a subscription.

Get all the IoT hubs in a subscription.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 257
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<String>] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 646
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventHubConsumerGroupsListResult] which provide lazy access to pages of the response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3028
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 689
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::V2017_01_19::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) click to toggle source

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.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [EventHubConsumerGroupsListResult] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2551
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) click to toggle source

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.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2588
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::V2017_01_19::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) click to toggle source

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.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2570
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param event_hub_endpoint_name [String] The name of the Event Hub-compatible endpoint. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 668
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<JobResponse>] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1097
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResponseListResult] which provide lazy access to pages of the response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3055
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1136
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::V2017_01_19::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) click to toggle source

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.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [JobResponseListResult] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2653
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) click to toggle source

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.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2690
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::V2017_01_19::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) click to toggle source

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.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2672
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1117
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<SharedAccessSignatureAuthorizationRule>] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1528
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SharedAccessSignatureAuthorizationRuleListResult] which provide lazy access to pages of the response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3107
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1567
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::V2017_01_19::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) click to toggle source

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.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SharedAccessSignatureAuthorizationRuleListResult] operation results.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2851
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) click to toggle source

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.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2888
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::V2017_01_19::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) click to toggle source

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.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2870
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) click to toggle source

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.

@param resource_group_name [String] The name of the resource group that contains the IoT hub. @param resource_name [String] The name of the IoT hub. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1548
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