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.
5442 5443 5444 5445 5446 5447 5448 5449 |
# File 'lib/svc.rb', line 5442 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.
5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 |
# File 'lib/svc.rb', line 5452 def list( filter, *args, deadline: nil ) req = V1::QueryListRequest.new() req. = V1::ListRequestMetadata.new() if not @parent.page_limit.nil? req..limit = @parent.page_limit 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, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) 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 |