Class: Aws::Plugins::RequestCompression Private

Inherits:
Seahorse::Client::Plugin show all
Defined in:
lib/aws-sdk-core/plugins/request_compression.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: CompressionHandler

Constant Summary collapse

DEFAULT_MIN_COMPRESSION_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

10_240
MIN_COMPRESSION_SIZE_LIMIT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

10_485_760
SUPPORTED_ENCODINGS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[gzip].freeze
CHUNK_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

one MB

1 * 1024 * 1024

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Plugin

#add_options, after_initialize, after_initialize_hooks, before_initialize, #before_initialize, before_initialize_hooks, handlers, literal, option, options

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response, #handler_for, #new_handler

Instance Method Details

#add_handlers(handlers, _config) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



58
59
60
61
# File 'lib/aws-sdk-core/plugins/request_compression.rb', line 58

def add_handlers(handlers, _config)
  # priority set to ensure compression happens BEFORE checksum
  handlers.add(CompressionHandler, priority: 16, step: :build)
end

#after_initialize(client) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



35
36
37
38
# File 'lib/aws-sdk-core/plugins/request_compression.rb', line 35

def after_initialize(client)
  validate_disable_request_compression_input(client.config)
  validate_request_min_compression_size_bytes_input(client.config)
end

#validate_disable_request_compression_input(cfg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
43
44
45
46
# File 'lib/aws-sdk-core/plugins/request_compression.rb', line 40

def validate_disable_request_compression_input(cfg)
  unless [true, false].include?(cfg.disable_request_compression)
    raise ArgumentError,
          'Must provide either `true` or `false` for the '\
          '`disable_request_compression` configuration option.'
  end
end

#validate_request_min_compression_size_bytes_input(cfg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
51
52
53
54
55
56
# File 'lib/aws-sdk-core/plugins/request_compression.rb', line 48

def validate_request_min_compression_size_bytes_input(cfg)
  value = Integer(cfg.request_min_compression_size_bytes)
  unless value.between?(0, MIN_COMPRESSION_SIZE_LIMIT)
    raise ArgumentError,
          'Must provide a non-negative integer value between '\
            '`0` and `10485760` bytes inclusive for the '\
            '`request_min_compression_size_bytes` configuration option.'
  end
end