class Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/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, if_match:nil, 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. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param if_match [String] ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2065
def begin_create_or_update(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil) 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. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param if_match [String] ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2112
def begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'iot_hub_description is nil' if iot_hub_description.nil?


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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
begin_create_or_update_with_http_info(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil) 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. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param if_match [String] ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2089
def begin_create_or_update_with_http_info(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers).value!
end
begin_delete(resource_group_name, resource_name, custom_headers:nil) 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. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2316
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. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2351
def begin_delete_async(resource_group_name, resource_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 404
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2334
def begin_delete_with_http_info(resource_group_name, resource_name, custom_headers:nil)
  begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
end
begin_update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil) click to toggle source

Update an existing IoT Hubs tags.

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

@param resource_group_name [String] Resource group identifier. @param resource_name [String] Name of iot hub to update. @param iot_hub_tags [TagsResource] Updated tag information to set into the iot hub instance. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2201
def begin_update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
  response = begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil) click to toggle source

Update an existing IoT Hubs tags.

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

@param resource_group_name [String] Resource group identifier. @param resource_name [String] Name of iot hub to update. @param iot_hub_tags [TagsResource] Updated tag information to set into the iot hub instance. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2240
def begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'iot_hub_tags is nil' if iot_hub_tags.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
begin_update_with_http_info(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil) click to toggle source

Update an existing IoT Hubs tags.

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

@param resource_group_name [String] Resource group identifier. @param resource_name [String] Name of iot hub to update. @param iot_hub_tags [TagsResource] Updated tag information to set into the iot hub instance. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2221
def begin_update_with_http_info(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
  begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
end
check_name_availability(operation_inputs, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1472
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1505
def check_name_availability_async(operation_inputs, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'operation_inputs is nil' if operation_inputs.nil?


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

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

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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1489
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 934
def create_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
  response = create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 975
def create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 955
def create_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
  create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
end
create_or_update(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil) 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. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param if_match [String] ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 146
def create_or_update(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
  response = create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil) 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. @param iot_hub_description [IotHubDescription] The IoT hub metadata and security metadata. @param if_match [String] ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 165
def create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 245
def delete(resource_group_name, resource_name, custom_headers:nil)
  response = delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
delete_async(resource_group_name, resource_name, custom_headers:nil) 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. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 260
def delete_async(resource_group_name, resource_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = {
        client_side_validation: true,
        required: false,
        serialized_name: 'parsed_response',
        type: {
          name: 'Object'
        }
      }
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

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

  promise
end
delete_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1047
def delete_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
  response = delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
  nil
end
delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1088
def delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
delete_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1068
def delete_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
  delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
end
export_devices(resource_group_name, resource_name, export_devices_parameters, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1807
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1854
def export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'export_devices_parameters is nil' if export_devices_parameters.nil?


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

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

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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1831
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/2018-01-22/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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 72
def get_async(resource_group_name, resource_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 816
def get_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
  response = get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 861
def get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 839
def get_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
  get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
end
get_job(resource_group_name, resource_name, job_id, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1260
def get_job(resource_group_name, resource_name, job_id, custom_headers:nil)
  response = get_job_async(resource_group_name, resource_name, job_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_job_async(resource_group_name, resource_name, job_id, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1301
def get_job_async(resource_group_name, resource_name, job_id, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'job_id is nil' if job_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1281
def get_job_with_http_info(resource_group_name, resource_name, job_id, custom_headers:nil)
  get_job_async(resource_group_name, resource_name, job_id, custom_headers:custom_headers).value!
end
get_keys_for_key_name(resource_group_name, resource_name, key_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1691
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1732
def get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'key_name is nil' if key_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1712
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1370
def get_quota_metrics(resource_group_name, resource_name, custom_headers:nil)
  first_page = get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
  first_page.get_all_items
end
get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3257
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1405
def get_quota_metrics_async(resource_group_name, resource_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2930
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2963
def get_quota_metrics_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2947
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1388
def get_quota_metrics_with_http_info(resource_group_name, resource_name, custom_headers:nil)
  get_quota_metrics_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
end
get_stats(resource_group_name, resource_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 489
def get_stats(resource_group_name, resource_name, custom_headers:nil)
  response = get_stats_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_stats_async(resource_group_name, resource_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 524
def get_stats_async(resource_group_name, resource_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 507
def get_stats_with_http_info(resource_group_name, resource_name, custom_headers:nil)
  get_stats_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
end
get_valid_skus(resource_group_name, resource_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 592
def get_valid_skus(resource_group_name, resource_name, custom_headers:nil)
  first_page = get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
  first_page.get_all_items
end
get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3176
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 627
def get_valid_skus_async(resource_group_name, resource_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2630
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2663
def get_valid_skus_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2647
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 610
def get_valid_skus_with_http_info(resource_group_name, resource_name, custom_headers:nil)
  get_valid_skus_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
end
get_with_http_info(resource_group_name, resource_name, custom_headers:nil) 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/2018-01-22/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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1936
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1983
def import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'import_devices_parameters is nil' if import_devices_parameters.nil?


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

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

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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1960
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 hub. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 389
def list_by_resource_group(resource_group_name, custom_headers:nil)
  first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
  first_page.get_all_items
end
list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil) 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 hub. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3151
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 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 422
def list_by_resource_group_async(resource_group_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2534
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2567
def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2551
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 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 406
def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
end
list_by_subscription(custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 295
def list_by_subscription(custom_headers:nil)
  first_page = list_by_subscription_as_lazy(custom_headers:custom_headers)
  first_page.get_all_items
end
list_by_subscription_as_lazy(custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3127
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 324
def list_by_subscription_async(custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2438
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2471
def list_by_subscription_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2455
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 310
def list_by_subscription_with_http_info(custom_headers:nil)
  list_by_subscription_async(custom_headers:custom_headers).value!
end
list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil) 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<EventHubConsumerGroupInfo>] operation results.

# File lib/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 699
def list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
  first_page = list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers)
  first_page.get_all_items
end
list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3205
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 742
def list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2728
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2765
def list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2747
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 721
def list_event_hub_consumer_groups_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
  list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers).value!
end
list_jobs(resource_group_name, resource_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1150
def list_jobs(resource_group_name, resource_name, custom_headers:nil)
  first_page = list_jobs_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
  first_page.get_all_items
end
list_jobs_as_lazy(resource_group_name, resource_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3232
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1189
def list_jobs_async(resource_group_name, resource_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2830
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2867
def list_jobs_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 2849
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1170
def list_jobs_with_http_info(resource_group_name, resource_name, custom_headers:nil)
  list_jobs_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
end
list_keys(resource_group_name, resource_name, custom_headers:nil) 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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1581
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3284
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1620
def list_keys_async(resource_group_name, resource_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3028
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3065
def list_keys_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 3047
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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 1601
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
update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil) click to toggle source

Update an existing IoT Hubs tags.

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

@param resource_group_name [String] Resource group identifier. @param resource_name [String] Name of iot hub to update. @param iot_hub_tags [TagsResource] Updated tag information to set into the iot hub instance. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 198
def update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
  response = update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil) click to toggle source

@param resource_group_name [String] Resource group identifier. @param resource_name [String] Name of iot hub to update. @param iot_hub_tags [TagsResource] Updated tag information to set into the iot hub instance. @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/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb, line 214
def update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::IotHub::Mgmt::V2018_01_22::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