aws-sdk-ec2 1.341.0 → 1.343.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,6 +21,10 @@ module Aws
21
21
 
22
22
  def call(context)
23
23
  params = context.params
24
+ unless params[:source_region]
25
+ raise ArgumentError,
26
+ 'Source region is required for copy_snapshot'
27
+ end
24
28
  params[:destination_region] = context.config.region
25
29
  params[:presigned_url] = presigned_url(context, params)
26
30
  @handler.call(context)
@@ -33,25 +37,26 @@ module Aws
33
37
  param_list.set('Action', 'CopySnapshot')
34
38
  param_list.set('DestinationRegion', context.config.region)
35
39
  param_list.set('Version', context.config.api.version)
36
- Aws::Query::EC2ParamBuilder.new(param_list).apply(context.operation.input, params)
40
+ Aws::Query::EC2ParamBuilder.new(param_list).apply(
41
+ context.operation.input, params
42
+ )
37
43
 
38
- signer = Aws::Sigv4::Signer.new(
39
- service: 'ec2',
44
+ endpoint_params = Aws::EC2::EndpointParameters.new(
40
45
  region: params[:source_region],
41
- credentials_provider: context.config.credentials
46
+ use_dual_stack: context.config.use_dualstack_endpoint,
47
+ use_fips: context.config.use_fips_endpoint
42
48
  )
43
- url = Aws::Partitions::EndpointProvider.resolve(
44
- signer.region, 'ec2', 'regional',
45
- {
46
- dualstack: context.config.use_dualstack_endpoint,
47
- fips: context.config.use_fips_endpoint
48
- }
49
+ endpoint = context.config.endpoint_provider
50
+ .resolve_endpoint(endpoint_params)
51
+ auth_scheme = Aws::Endpoints.resolve_auth_scheme(context, endpoint)
52
+
53
+ signer = Aws::Plugins::Sign.signer_for(
54
+ auth_scheme, context.config, params[:source_region]
49
55
  )
50
- url += "?#{param_list.to_s}"
51
56
 
52
57
  signer.presign_url(
53
58
  http_method: 'GET',
54
- url: url,
59
+ url: "#{endpoint.url}?#{param_list}",
55
60
  body: '',
56
61
  expires_in: 3600
57
62
  ).to_s