Class: Aws::Signers::V2 Private

Inherits:
Base
  • Object
show all
Defined in:
lib/aws-sdk-core/signers/v2.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.

Instance Method Summary collapse

Methods inherited from Base

#initialize, sign

Constructor Details

This class inherits a constructor from Aws::Signers::Base

Instance Method Details

#sign(http_request) ⇒ 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.

Parameters:

  • http_request (Http::Request)

6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/aws-sdk-core/signers/v2.rb', line 6

def sign(http_request)
  params = http_request.body.param_list
  params.set('AWSAccessKeyId', @credentials.access_key_id)
  params.set('SecurityToken', @credentials.session_token) if
    @credentials.session_token
  params.set('Timestamp', Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ'))
  params.set('SignatureVersion', '2')
  params.set('SignatureMethod', 'HmacSHA256')
  params.delete('Signature')
  params.set('Signature', signature(http_request, params))
  http_request.body = params.to_io
end