class AwsRecord::Generators::SecondaryIndex
def initialize(name, opts)
def initialize(name, opts) raise ArgumentError.new("You must provide a name") if not name raise ArgumentError.new("You must provide a hash key") if not opts[:hash_key] if opts.key? :projection_type raise ArgumentError.new("Invalid projection type #{opts[:projection_type]}") if not PROJ_TYPES.include? opts[:projection_type] raise NotImplementedError.new("ALL is the only projection type currently supported") if opts[:projection_type] != "ALL" else opts[:projection_type] = "ALL" end if opts[:hash_key] == opts[:range_key] raise ArgumentError.new("#{opts[:hash_key]} cannot be both the rkey and hkey for gsi #{name}") end @name = name @hash_key = opts[:hash_key] @range_key = opts[:range_key] @projection_type = '"' + "#{opts[:projection_type]}" + '"' end