Class: SDM::Queries
Overview
A Query is a record of a single client request to a resource, such as a SQL query. Long-running SSH, RDP, or Kubernetes interactive sessions also count as queries. The Queries service is read-only.
See Query.
Instance Method Summary collapse
-
#initialize(channel, parent) ⇒ Queries
constructor
A new instance of Queries.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Queries matching a given set of criteria.
Constructor Details
#initialize(channel, parent) ⇒ Queries
Returns a new instance of Queries.
2420 2421 2422 2423 2424 2425 2426 2427 |
# File 'lib/svc.rb', line 2420 def initialize(channel, parent) begin @stub = V1::Queries::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Queries matching a given set of criteria.
2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 |
# File 'lib/svc.rb', line 2430 def list( filter, *args, deadline: nil ) req = V1::QueryListRequest.new() req. = V1::ListRequestMetadata.new() page_size_option = @parent.["PageSize"] if page_size_option.is_a? Integer req..limit = page_size_option end if not @parent.snapshot_time.nil? req..snapshot_at = @parent.snapshot_time end req.filter = Plumbing::quote_filter_args(filter, *args) resp = Enumerator::Generator.new { |g| tries = 0 loop do begin plumbing_response = @stub.list(req, metadata: @parent.("Queries.List", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end tries = 0 plumbing_response.queries.each do |plumbing_item| g.yield Plumbing::convert_query_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |