Class: SDM::AccessRequestsHistory

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

Overview

AccessRequestsHistory provides records of all changes to the state of an AccessRequest.

See AccessRequestHistory.

Instance Method Summary collapse

Constructor Details

#initialize(channel, parent) ⇒ AccessRequestsHistory

Returns a new instance of AccessRequestsHistory.



166
167
168
169
170
171
172
173
# File 'lib/svc.rb', line 166

def initialize(channel, parent)
  begin
    @stub = V1::AccessRequestsHistory::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 AccessRequestHistory records matching a given set of criteria.



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/svc.rb', line 176

def list(
  filter,
  *args,
  deadline: nil
)
  req = V1::AccessRequestHistoryListRequest.new()
  req.meta = V1::ListRequestMetadata.new()
  if @parent.page_limit > 0
    req.meta.limit = @parent.page_limit
  end
  if not @parent.snapshot_time.nil?
    req.meta.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.("AccessRequestsHistory.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.history.each do |plumbing_item|
        g.yield Plumbing::convert_access_request_history_to_porcelain(plumbing_item)
      end
      break if plumbing_response.meta.next_cursor == ""
      req.meta.cursor = plumbing_response.meta.next_cursor
    end
  }
  resp
end