def run_promise(&block)
      Concurrent::Promise.new do
        @connection ||= Faraday.new(:url => base_uri, :ssl => MsRest.ssl_options) do |faraday|
          middlewares.each{ |args| faraday.use(*args) } unless middlewares.nil?
          faraday.adapter Faraday.default_adapter
          logging = ENV['AZURE_HTTP_LOGGING'] || log
          if logging
            faraday.response :logger, nil, { :bodies => logging == 'full' }
          end
        end

        loop do
          @response = @connection.run_request(:"#{method}", build_path, body, {'User-Agent' => user_agent}.merge(headers)) do |req|
            req.params = req.params.merge(query_params.reject{|_, v| v.nil?}) unless query_params.nil?
            yield(req) if block_given?
          end

          break if ((@response.status != 429) || (@response.status == 429 && @response.headers['retry-after'].nil?))

          if(@response.status == 429 && !@response.headers['retry-after'].nil?)
            sleep(@response.headers['retry-after'].to_i)
          end
        end
        @response
      end
    end
def run_promise(&block)
      Concurrent::Promise.new do
        @connection ||= Faraday.new(:url => base_uri, :ssl => MsRest.ssl_options) do |faraday|
          middlewares.each{ |args| faraday.use(*args) } unless middlewares.nil?
          faraday.adapter Faraday.default_adapter
          logging = ENV['AZURE_HTTP_LOGGING'] || log
          if logging
            faraday.response :logger, nil, { :bodies => logging == 'full' }
          end
        end

        loop do
          @response = @connection.run_request(:"#{method}", build_path, body, {'User-Agent' => user_agent}.merge(headers)) do |req|
            req.params = req.params.merge(query_params.reject{|_, v| v.nil?}) unless query_params.nil?
            yield(req) if block_given?
          end

          break if ((@response.status != 429) || (@response.status == 429 && @response.headers['retry-after'].nil?))

          if(@response.status == 429 && !@response.headers['retry-after'].nil?)
            sleep(@response.headers['retry-after'].to_i)
          end
        end
        @response
      end
    end
Creates and initialize new instance of the HttpOperationResponse class.
 @param [String|URI] base uri for requests
 @param [String] path template /{replace}/{url_param}
 @param [String] http method for the request
 @param [Hash] body the HTTP response body.
 Creates a promise which will execute the request. Block will yield the request for customization.
 @return [URI] body the HTTP response body.