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
cmonson_2ndwatch_awspec-0.85.4 lib/awspec/helper/finder/subnet.rb
awspec-0.85.3 lib/awspec/helper/finder/subnet.rb
cmonson_2ndwatch_awspec-0.85.3 lib/awspec/helper/finder/subnet.rb
awspec-0.85.2 lib/awspec/helper/finder/subnet.rb
awspec-0.85.1 lib/awspec/helper/finder/subnet.rb
awspec-0.85.0 lib/awspec/helper/finder/subnet.rb
awspec-0.84.1 lib/awspec/helper/finder/subnet.rb
awspec-0.84.0 lib/awspec/helper/finder/subnet.rb
awspec-0.83.0 lib/awspec/helper/finder/subnet.rb
awspec-0.82.3 lib/awspec/helper/finder/subnet.rb
awspec-0.82.2 lib/awspec/helper/finder/subnet.rb
awspec-0.82.1 lib/awspec/helper/finder/subnet.rb
awspec-0.82.0 lib/awspec/helper/finder/subnet.rb
awspec-0.81.1 lib/awspec/helper/finder/subnet.rb
awspec-0.81.0 lib/awspec/helper/finder/subnet.rb
awspec-0.80.1 lib/awspec/helper/finder/subnet.rb