Class: SDM::GroupsRolesHistory

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

Overview

GroupsRolesHistory records all changes to the state of a GroupRole.

See GroupRoleHistory.

Instance Method Summary collapse

Constructor Details

#initialize(channel, parent) ⇒ GroupsRolesHistory

Returns a new instance of GroupsRolesHistory.



3044
3045
3046
3047
3048
3049
3050
3051
# File 'lib/svc.rb', line 3044

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



3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
# File 'lib/svc.rb', line 3054

def list(
  filter,
  *args,
  deadline: nil
)
  req = V1::GroupRoleHistoryListRequest.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.filter = Plumbing::quote_filter_args(filter, *args)
  resp = Enumerator::Generator.new { |g|
    tries = 0
    loop do
      begin
        plumbing_response = @stub.list(req, metadata: @parent.("GroupsRolesHistory.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.history.each do |plumbing_item|
        g.yield Plumbing::convert_group_role_history_to_porcelain(plumbing_item)
      end
      break if plumbing_response.meta.next_cursor == ""
      req.meta.cursor = plumbing_response.meta.next_cursor
    end
  }
  resp
end