Module: Shrine::Plugins::AwsLambda::ClassMethods

Defined in:
lib/shrine/plugins/aws_lambda.rb

Instance Method Summary collapse

Instance Method Details

#lambda_client(access_key_id: , secret_access_key: , region: , **args) ⇒ Object

Creates a new AWS Lambda client



258
259
260
261
262
263
264
265
# File 'lib/shrine/plugins/aws_lambda.rb', line 258

def lambda_client(access_key_id:     opts[:access_key_id],
                  secret_access_key: opts[:secret_access_key],
                  region:            opts[:region], **args)

  Aws::Lambda::Client.new(args.merge!(access_key_id:     access_key_id,
                                      secret_access_key: secret_access_key,
                                      region:            region))
end

#lambda_function_list(master_region: nil, function_version: 'ALL', marker: nil, items: 100, force: false) ⇒ Object

Memoize and returns a list of your Lambda functions. For each function, the response includes the function configuration information.

Parameters:

  • force (Boolean) (defaults to: false)

    reloading the list via request to AWS if true



272
273
274
275
276
277
278
279
280
# File 'lib/shrine/plugins/aws_lambda.rb', line 272

def lambda_function_list(master_region: nil, function_version: 'ALL', marker: nil, items: 100, force: false)
  fl = opts[:lambda_function_list]
  return fl unless force || fl.nil? || fl.empty?

  opts[:lambda_function_list] = lambda_client.list_functions(master_region:    master_region,
                                                             function_version: function_version,
                                                             marker:           marker,
                                                             max_items:        items).functions
end