api/generated/ruby/azure-iiot-opc-registry/generated/swagger/azure_opc_registry_client.rb
def create_application_async(body, custom_headers:nil)
      fail ArgumentError, 'body is nil' if body.nil?


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

      # Serialize Request
      request_mapper = azure.iiot.opc.registry::Models::ApplicationRegistrationRequestApiModel.mapper()
      request_content = self.serialize(request_mapper,  body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'v2/applications'

      request_url = @base_url || self.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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

        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = azure.iiot.opc.registry::Models::ApplicationRegistrationResponseApiModel.mapper()
            result.body = self.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 new application
#
# The application is registered using the provided information, but it is not
# associated with a supervisor. This is useful for when you need to register
# clients or you want to register a server that is located in a network not
# reachable through a Twin module.
#
# @param body [ApplicationRegistrationRequestApiModel] Application registration
# request
# @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.
#
Create new application
The application is registered using the provided information, but it is not
associated with a supervisor. This is useful for when you need to register
clients or you want to register a server that is located in a network not
reachable through a Twin module.
Create new application The application is registered using the provided information but it is not associated with a supervisor . This is useful for when you need to register clients or you want to register a server that is located in a network not reachable through a Twin module .
def create_application_async(body, custom_headers:nil)
      fail ArgumentError, 'body is nil' if body.nil?
      request_headers = {}
      request_headers['Content-Type'] = 'application/json-patch+json; charset=utf-8'
      request_mapper = azure.iiot.opc.registry::Models::ApplicationRegistrationRequestApiModel.mapper()
      request_content = self.serialize(request_mapper,  body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
      path_template = 'v2/applications'
      request_url = @base_url || self.base_url
      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = azure.iiot.opc.registry::Models::ApplicationRegistrationResponseApiModel.mapper()
            result.body = self.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
def create_application_async ( body , custom_headers : nil ) fail ArgumentError , 'body is nil' if body . nil? request_headers = { } request_headers [ 'Content-Type' ] = 'application/json-patch+json; charset=utf-8' request_mapper = azure . iiot . opc . registry :: Models :: ApplicationRegistrationRequestApiModel . mapper ( ) request_content = self . serialize ( request_mapper , body ) request_content = request_content != nil ? JSON . generate ( request_content , quirks_mode : true ) : nil path_template = 'v2/applications' request_url = @base_url || self . base_url options = { middlewares : [ [ MsRest :: RetryPolicyMiddleware , times : 3 , retry : 0.02 ] , [ :cookie_jar ] ] , body : request_content , headers : request_headers . merge ( custom_headers || { } ) , base_url : request_url } promise = self . 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 if status_code == 200 begin parsed_response = response_content . to_s . empty? ? nil : JSON . load ( response_content ) result_mapper = azure . iiot . opc . registry :: Models :: ApplicationRegistrationResponseApiModel . mapper ( ) result . body = self . 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 new application
The application is registered using the provided information, but it is not
associated with a supervisor.
Create new application The application is registered using the provided information but it is not associated with a supervisor .
# Serialize Request # Deserialize Response
Promise object which holds the HTTP response.
Promise object which holds the HTTP response .
Concurrent::Promise
body
Application registration request
Application registration request
custom_headers
A hash of custom headers that will be added to the HTTP request.
A hash of custom headers that will be added to the HTTP request .