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.
1497 1498 1499 1500 1501 1502 1503 1504 |
# File 'lib/svc.rb', line 1497 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.
1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 |
# File 'lib/svc.rb', line 1507 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 |