Sha256: a748d76818df939ea9d1c6d22a7cd12df36f385be38063d39d9f902acbcbfd95
Contents?: true
Size: 861 Bytes
Versions: 855
Compression:
Stored size: 861 Bytes
Contents
require 'securerandom' module Aws module Plugins # Provides support for auto filling operation parameters # that enabled with `idempotencyToken` trait with random UUID v4 # when no value is provided class IdempotencyToken < Seahorse::Client::Plugin # @api private class Handler < Seahorse::Client::Handler # @param [RequestContext] context # @param [Response] def call(context) auto_fill(context.params, context.operation.input) @handler.call(context) end private def auto_fill(params, ref) ref.shape.members.each do |name, member_ref| if member_ref['idempotencyToken'] params[name] ||= SecureRandom.uuid end end end end handler(Handler, step: :initialize) end end end
Version data entries
855 entries across 855 versions & 1 rubygems