class AwsDevUtils::ClientWrapper
Public Class Methods
new(client, options={})
click to toggle source
Initialize a new ClientWrapper
, internal use only @params [Seahorse::Client::Base] client @param [Hash] options @option options [String] next_token max number of requests @option options [String] retry max number of retries @option options [String] cache the key-value timeout
# File lib/aws-dev-utils/client_wrapper.rb, line 11 def initialize client, options={} @client = client @options = options end
Public Instance Methods
method_missing(m, *args, &block)
click to toggle source
# File lib/aws-dev-utils/client_wrapper.rb, line 31 def method_missing m, *args, &block client_name = @client.class.name @client = RetryWrapper.new(@client, @options[:retry]) if retry? @client = NextTokenWrapper.new(@client, @options[:next_token]) if next_token? @client = CacheWrapper.new(@client, @options[:cache], client_name: client_name) if cache? nested_struct(@client.send(m, *args, &block)) end
with_cache(exp=60)
click to toggle source
@return ClientWrapper
with cache option
# File lib/aws-dev-utils/client_wrapper.rb, line 27 def with_cache exp=60 self.class.new(@client, @options.merge(cache: exp)) end
with_next_token(max=NextTokenWrapper::DEFAULT_MAX)
click to toggle source
@return ClientWrapper
with next_token option
# File lib/aws-dev-utils/client_wrapper.rb, line 17 def with_next_token max=NextTokenWrapper::DEFAULT_MAX self.class.new(@client, @options.merge(next_token: max)) end
with_retry(max=5)
click to toggle source
@return ClientWrapper
with retry option
# File lib/aws-dev-utils/client_wrapper.rb, line 22 def with_retry max=5 self.class.new(@client, @options.merge(retry: max)) end
Private Instance Methods
cache?()
click to toggle source
# File lib/aws-dev-utils/client_wrapper.rb, line 42 def cache? @options[:cache] end
next_token?()
click to toggle source
# File lib/aws-dev-utils/client_wrapper.rb, line 50 def next_token? @options[:next_token] end
retry?()
click to toggle source
# File lib/aws-dev-utils/client_wrapper.rb, line 46 def retry? @options[:retry] end