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.24.4 lib/awspec/helper/finder/subnet.rb
awspec-1.24.3 lib/awspec/helper/finder/subnet.rb
awspec-1.24.2 lib/awspec/helper/finder/subnet.rb
awspec-1.24.1 lib/awspec/helper/finder/subnet.rb
awspec-1.24.0 lib/awspec/helper/finder/subnet.rb
awspec-1.23.0 lib/awspec/helper/finder/subnet.rb
awspec-1.22.1 lib/awspec/helper/finder/subnet.rb
awspec-1.22.0 lib/awspec/helper/finder/subnet.rb
awspec-1.21.1 lib/awspec/helper/finder/subnet.rb
awspec-1.21.0 lib/awspec/helper/finder/subnet.rb
awspec-1.20.0 lib/awspec/helper/finder/subnet.rb
awspec-1.19.2 lib/awspec/helper/finder/subnet.rb
awspec-1.19.1 lib/awspec/helper/finder/subnet.rb
awspec-1.19.0 lib/awspec/helper/finder/subnet.rb
cthiesfork-awspec-1.2.4 lib/awspec/helper/finder/subnet.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/helper/finder/subnet.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/helper/finder/subnet.rb
awspec-1.18.6 lib/awspec/helper/finder/subnet.rb
cthiesfork-awspec-1.2.2 lib/awspec/helper/finder/subnet.rb
cthiesfork-awspec-1.2.1 lib/awspec/helper/finder/subnet.rb