class Aws::Plugins::EC2CopyEncryptedSnapshot::Handler

@api private

Public Instance Methods

call(context) click to toggle source
# File lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb, line 18
def call(context)
  params = context.params
  params[:destination_region] = context.config.region
  params[:presigned_url] = presigned_url(context, params)
  @handler.call(context)
end

Private Instance Methods

presigned_url(context, params) click to toggle source
# File lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb, line 27
def presigned_url(context, params)
  param_list = Aws::Query::ParamList.new
  param_list.set('Action', 'CopySnapshot')
  param_list.set('DestinationRegion', context.config.region)
  param_list.set('Version', context.config.api.metadata['apiVersion'])
  Aws::Query::EC2ParamBuilder.new(param_list).apply(context.operation.input, params)

  signer = Aws::Sigv4::Signer.new(
    service: 'ec2',
    region: params[:source_region],
    credentials_provider: context.config.credentials
  )
  url = Aws::EndpointProvider.resolve(signer.region, 'ec2')
  url += "?#{param_list.to_s}"

  signer.presign_url(
    http_method: 'GET',
    url: url,
    body: '',
    expires_in: 3600
  ).to_s
end