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.



7096
7097
7098
7099
7100
7101
7102
7103
# File 'lib/svc.rb', line 7096

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.



7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
# File 'lib/svc.rb', line 7106

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