class Aws::EventStream::HeaderValue

def format_timestamp(value)

def format_timestamp(value)
  # millis_since_epoch to sec_since_epoch
  Time.at(value / 1000.0)
end

def format_uuid(value)

def format_uuid(value)
  bytes = value.bytes
  # For user-friendly uuid representation,
  # format binary bytes into uuid string format
  uuid_pattern = [ [ 3, 2, 1, 0 ], [ 5, 4 ], [ 7, 6 ], [ 8, 9 ], 10..15 ]
  uuid_pattern.map {|p| p.map {|n| "%02x" % bytes.to_a[n] }.join }.join('-')
end

def format_value(value)

def format_value(value)
  case @type
  when 'timestamp' then format_timestamp(value)
  when 'uuid' then format_uuid(value)
  else
    value
  end
end

def initialize(options)

def initialize(options)
  @type = options.fetch(:type)
  @value = options[:format] ?
    format_value(options.fetch(:value)) :
    options.fetch(:value)
end