Sha256: 4db060c855a6d4e0ee2814479a2be4fd61cd3077eaece7bc02a075998ae179dd

Contents?: true

Size: 913 Bytes

Versions: 8

Compression:

Stored size: 913 Bytes

Contents

module Awspec::Helper
  module Finder
    module Ebs
      def find_ebs(volume_id)
        res = @ec2_client.describe_volumes({
                                             filters: [{ name: 'volume-id', values: [volume_id] }]
                                           })
        return res[:volumes][0] if res[:volumes].count == 1
        res = @ec2_client.describe_volumes({
                                             filters: [{ name: 'tag:Name', values: [volume_id] }]
                                           })
        return res[:volumes][0] if res[:volumes].count == 1
      end

      def select_ebs_by_instance_id(id)
        res = find_ec2(id)
        volumes = []
        return volumes unless res
        res[:block_device_mappings].each do |block|
          volume = find_ebs(block.ebs.volume_id)
          volumes.push(volume) if volume
        end
        volumes
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
awspec-0.9.0 lib/awspec/helper/finder/ebs.rb
awspec-0.8.1 lib/awspec/helper/finder/ebs.rb
awspec-0.8.0 lib/awspec/helper/finder/ebs.rb
awspec-0.7.0 lib/awspec/helper/finder/ebs.rb
awspec-0.6.4 lib/awspec/helper/finder/ebs.rb
awspec-0.6.3 lib/awspec/helper/finder/ebs.rb
awspec-0.6.2 lib/awspec/helper/finder/ebs.rb
awspec-0.6.1 lib/awspec/helper/finder/ebs.rb