class Aws::Log::ParamFilter

Constants

SENSITIVE

DEPRECATED - This must exist for backwards compatibility. Sensitive members are now computed for each request/response type. This can be removed in a new major version. This list is no longer updated.

A managed list of sensitive parameters that should be filtered from logs. This is updated automatically as part of each release. See the ‘tasks/update-sensitive-params.rake` for more information.

@api private begin

Public Class Methods

new(options = {}) click to toggle source

end

# File lib/aws-sdk-core/log/param_filter.rb, line 22
def initialize(options = {})
  @enabled = options[:filter_sensitive_params] != false
  @additional_filters = options[:filter] || []
end

Public Instance Methods

filter(values, type) click to toggle source
# File lib/aws-sdk-core/log/param_filter.rb, line 27
def filter(values, type)
  case values
  when Struct then filter_struct(values, type)
  when Hash then filter_hash(values, type)
  when Array then filter_array(values, type)
  else values
  end
end

Private Instance Methods

filter_array(values, type) click to toggle source
# File lib/aws-sdk-core/log/param_filter.rb, line 64
def filter_array(values, type)
  values.map { |value| filter(value, value.class) }
end
filter_hash(values, type) click to toggle source
# File lib/aws-sdk-core/log/param_filter.rb, line 45
def filter_hash(values, type)
  if type.const_defined?('SENSITIVE')
    filters = type::SENSITIVE + @additional_filters
  else
    # Support backwards compatibility (new core + old service)
    filters = SENSITIVE + @additional_filters
  end

  filtered = {}
  values.each_pair do |key, value|
    filtered[key] = if @enabled && filters.include?(key)
      '[FILTERED]'
    else
      filter(value, value.class)
    end
  end
  filtered
end
filter_struct(values, type) click to toggle source
# File lib/aws-sdk-core/log/param_filter.rb, line 38
def filter_struct(values, type)
  if values.class.include? Aws::Structure::Union
    values = { values.member => values.value }
  end
  filter_hash(values, type)
end