Sha256: ca98792df26e3fc47241533983d009d7412519af7020baced01183dfa83599b8

Contents?: true

Size: 1.14 KB

Versions: 96

Compression:

Stored size: 1.14 KB

Contents

module Awspec::Helper
  module Finder
    module Subnet
      def find_subnet(subnet_id)
        res = ec2_client.describe_subnets({
                                            filters: [{ name: 'subnet-id', values: [subnet_id] }]
                                          })
        resource = res.subnets.single_resource(subnet_id)
        return resource if resource
        res = ec2_client.describe_subnets({
                                            filters: [{ name: 'tag:Name', values: [subnet_id] }]
                                          })
        resource = res.subnets.single_resource(subnet_id)
        return resource if resource
        res = ec2_client.describe_subnets({
                                            filters: [{ name: 'cidrBlock', values: [subnet_id] }]
                                          })
        res.subnets.single_resource(subnet_id)
      end

      def select_subnet_by_vpc_id(vpc_id)
        res = ec2_client.describe_subnets({
                                            filters: [{ name: 'vpc-id', values: [vpc_id] }]
                                          })
        res.subnets
      end
    end
  end
end

Version data entries

96 entries across 96 versions & 4 rubygems

Version Path
awspec-1.14.1 lib/awspec/helper/finder/subnet.rb
awspec-1.14.0 lib/awspec/helper/finder/subnet.rb
awspec-1.13.0 lib/awspec/helper/finder/subnet.rb
awspec-1.12.7 lib/awspec/helper/finder/subnet.rb
awspec-1.12.6 lib/awspec/helper/finder/subnet.rb
awspec-1.12.5 lib/awspec/helper/finder/subnet.rb
awspec-1.12.4 lib/awspec/helper/finder/subnet.rb
awspec-1.12.3 lib/awspec/helper/finder/subnet.rb
awspec-1.12.2 lib/awspec/helper/finder/subnet.rb
awspec-1.12.1 lib/awspec/helper/finder/subnet.rb
awspec-1.12.0 lib/awspec/helper/finder/subnet.rb
awspec-1.11.1 lib/awspec/helper/finder/subnet.rb
awspec-1.11.0 lib/awspec/helper/finder/subnet.rb
awspec-1.10.0 lib/awspec/helper/finder/subnet.rb
awspec-1.9.0 lib/awspec/helper/finder/subnet.rb
awspec-1.8.0 lib/awspec/helper/finder/subnet.rb
awspec-1.7.0 lib/awspec/helper/finder/subnet.rb
awspec-1.6.1 lib/awspec/helper/finder/subnet.rb
awspec-1.6.0 lib/awspec/helper/finder/subnet.rb
awspec-1.5.4 lib/awspec/helper/finder/subnet.rb