api/generated/ruby/azure-iiot-opc-registry/generated/swagger/azure_opc_registry_client.rb
#
# Query endpoints
#
# Return endpoints that match the specified query. The returned model can
# contain a continuation token if more results are available. Call the
# GetListOfEndpoints operation using the token to retrieve more results.
#
# @param body [EndpointRegistrationQueryApiModel] Query to match
# @param only_server_state [Boolean] Whether to include only server state, or
# display current client state of the endpoint if available
# @param page_size [Integer] Optional number of results to return
# @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.
#
Query endpoints
Return endpoints that match the specified query. The returned model can
contain a continuation token if more results are available. Call the
GetListOfEndpoints operation using the token to retrieve more results.
Query endpoints Return endpoints that match the specified query . The returned model can contain a continuation token if more results are available . Call the GetListOfEndpoints operation using the token to retrieve more results .
def query_endpoints_async(body, only_server_state:nil, page_size:nil, 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::EndpointRegistrationQueryApiModel.mapper()
      request_content = self.serialize(request_mapper,  body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
      path_template = 'v2/endpoints/query'
      request_url = @base_url || self.base_url
      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'onlyServerState' => only_server_state,'pageSize' => page_size},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = azure.iiot.opc.registry::Models::EndpointInfoListApiModel.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 query_endpoints_async ( body , only_server_state : nil , page_size : nil , 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 :: EndpointRegistrationQueryApiModel . mapper ( ) request_content = self . serialize ( request_mapper , body ) request_content = request_content != nil ? JSON . generate ( request_content , quirks_mode : true ) : nil path_template = 'v2/endpoints/query' request_url = @base_url || self . base_url options = { middlewares : [ [ MsRest :: RetryPolicyMiddleware , times : 3 , retry : 0.02 ] , [ :cookie_jar ] ] , query_params : { 'onlyServerState' => only_server_state , 'pageSize' => page_size } , body : request_content , headers : request_headers . merge ( custom_headers || { } ) , base_url : request_url } promise = self . 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 if status_code == 200 begin parsed_response = response_content . to_s . empty? ? nil : JSON . load ( response_content ) result_mapper = azure . iiot . opc . registry :: Models :: EndpointInfoListApiModel . 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
Query endpoints
Return endpoints that match the specified query.
Query endpoints Return endpoints that match the specified query .
# Serialize Request # Deserialize Response
Promise object which holds the HTTP response.
Promise object which holds the HTTP response .
Concurrent::Promise
body
Query to match
Query to match
only_server_state
Whether to include only server state, or display current client state of the endpoint if available
Whether to include only server state or display current client state of the endpoint if available
page_size
Optional number of results to return
Optional number of results to return
custom_headers
<not_specific>
<not_specific>
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 .