class Aws::Plugins::EC2CopyEncryptedSnapshot::PresignHandler
This handler intentionally does NOT call the next handler in the stack. It generates a presigned url from the request and returns it as the response data.
Before signing:
-
The HTTP method is changed from POST to GET
-
The url-encoded body is moved to the querystring
@api private
Public Instance Methods
call(context)
click to toggle source
# File lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb, line 54 def call(context) convert_post_2_get(context) Seahorse::Client::Response.new( context: context, data: presigned_url(context.http_request, context.config)) end
Private Instance Methods
convert_post_2_get(context)
click to toggle source
# File lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb, line 63 def convert_post_2_get(context) context.http_request.http_method = 'GET' context.http_request.endpoint = new_endpoint(context) context.http_request.body = '' context.http_request.headers.delete('Content-Type') end
new_endpoint(context)
click to toggle source
# File lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb, line 70 def new_endpoint(context) body = context.http_request.body_contents endpoint = context.http_request.endpoint endpoint.query = body endpoint end
presigned_url(http_request, config)
click to toggle source
# File lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb, line 77 def presigned_url(http_request, config) signer = Signers::V4.new(config.credentials, 'ec2', config.region) signer.presigned_url(http_request, expires_in: 3600) end