Class: SDM::RequestableAccountEntitlements

Inherits:
Object
  • Object
show all
Extended by:
Gem::Deprecate
Defined in:
lib/svc.rb

Overview

RequestableAccountEntitlements enumerates the resources that an account is permitted to request access to. The RequestableAccountEntitlements service is read-only.

See RequestableAccountEntitlement.

Instance Method Summary collapse

Constructor Details

#initialize(channel, parent) ⇒ RequestableAccountEntitlements

Returns a new instance of RequestableAccountEntitlements.



6976
6977
6978
6979
6980
6981
6982
6983
# File 'lib/svc.rb', line 6976

def initialize(channel, parent)
  begin
    @stub = V1::RequestableAccountEntitlements::Stub.new(nil, nil, channel_override: channel)
  rescue => exception
    raise Plumbing::convert_error_to_porcelain(exception)
  end
  @parent = parent
end

Instance Method Details

#list(account_id, filter, *args, deadline: nil) ⇒ Object

List gets a list of RequestableAccountEntitlement records matching a given set of criteria.



6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
# File 'lib/svc.rb', line 6986

def list(
  ,
  filter,
  *args,
  deadline: nil
)
  req = V1::RequestableAccountEntitlementListRequest.new()
  req.meta = V1::ListRequestMetadata.new()
  if not @parent.page_limit.nil?
    req.meta.limit = @parent.page_limit
  end
  if not @parent.snapshot_time.nil?
    req.meta.snapshot_at = @parent.snapshot_time
  end

  req. = ()
  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.("RequestableAccountEntitlements.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..each do |plumbing_item|
        g.yield Plumbing::(plumbing_item)
      end
      break if plumbing_response.meta.next_cursor == ""
      req.meta.cursor = plumbing_response.meta.next_cursor
    end
  }
  resp
end