Module: Aws::EC2::ResourcePaginationFix

Included in:
Resource
Defined in:
lib/aws-sdk-ec2/customizations/resource.rb

Overview

5 of EC2’s old APIs DescribeInstances, DescribeImages, DescribeSnapshots, DescribeVolumes and DescribeTag support paginated calls and will not paginate server side unless max_results is set to a non-nil value. This module customizes the resource association methods by adding a default value of 1000 to max_results to ensure results are paginated.

Instance Method Summary collapse

Instance Method Details

#images(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/aws-sdk-ec2/customizations/resource.rb', line 11

def images(options = {})
  # Prevent the error:
  # The parameter imageIdsSet cannot be used with the parameter maxResults
  if options[:image_ids].nil? || options[:image_ids].empty?
    options[:max_results] ||= 1000
  end
  super(options)
end

#instances(options = {}) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/aws-sdk-ec2/customizations/resource.rb', line 20

def instances(options = {})
  # Prevent the error:
  # The parameter instancesSet cannot be used with the parameter maxResults
  if options[:instance_ids].nil? || options[:instance_ids].empty?
    options[:max_results] ||= 1000
  end
  super(options)
end

#snapshots(options = {}) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/aws-sdk-ec2/customizations/resource.rb', line 29

def snapshots(options = {})
  # Prevent the error:
  # The parameter snapshotSet cannot be used with the parameter maxResults
  if options[:snapshot_ids].nil? || options[:snapshot_ids].empty?
    options[:max_results] ||= 1000
  end
  super(options)
end

#volumes(options = {}) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/aws-sdk-ec2/customizations/resource.rb', line 38

def volumes(options = {})
  # Prevent the error:
  # The parameter volumeIdsSet cannot be used with the parameter maxResults
  if options[:volume_ids].nil? || options[:volume_ids].empty?
    options[:max_results] ||= 1000
  end
  super(options)
end