Sha256: 50bc4f41abe045bb3059cc8d99bc5488a9206e289a00a658a07b39f0b04172c5

Contents?: true

Size: 1.26 KB

Versions: 61

Compression:

Stored size: 1.26 KB

Contents

module Awspec::Helper
  module Finder
    module SecurityGroup
      def find_security_group(sg_id)
        res = ec2_client.describe_security_groups({
                                                    filters: [{ name: 'group-id', values: [sg_id] }]
                                                  })
        resource = res.security_groups.single_resource(sg_id)
        return resource if resource
        res = ec2_client.describe_security_groups({
                                                    filters: [{ name: 'group-name', values: [sg_id] }]
                                                  })
        resource = res.security_groups.single_resource(sg_id)
        return resource if resource
        res = ec2_client.describe_security_groups({
                                                    filters: [{ name: 'tag:Name', values: [sg_id] }]
                                                  })
        res.security_groups.single_resource(sg_id)
      end

      def select_security_group_by_vpc_id(vpc_id)
        res = ec2_client.describe_security_groups({
                                                    filters: [{ name: 'vpc-id', values: [vpc_id] }]
                                                  })
        res.security_groups
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
awspec-0.70.0 lib/awspec/helper/finder/security_group.rb
awspec-0.69.1 lib/awspec/helper/finder/security_group.rb
awspec-0.69.0 lib/awspec/helper/finder/security_group.rb
awspec-0.68.0 lib/awspec/helper/finder/security_group.rb
awspec-0.67.1 lib/awspec/helper/finder/security_group.rb
awspec-0.67.0 lib/awspec/helper/finder/security_group.rb
awspec-0.66.2 lib/awspec/helper/finder/security_group.rb
awspec-0.66.1 lib/awspec/helper/finder/security_group.rb
awspec-0.66.0 lib/awspec/helper/finder/security_group.rb
awspec-0.65.2 lib/awspec/helper/finder/security_group.rb
awspec-0.65.1 lib/awspec/helper/finder/security_group.rb
awspec-0.65.0 lib/awspec/helper/finder/security_group.rb
awspec-0.64.0 lib/awspec/helper/finder/security_group.rb
awspec-0.63.1 lib/awspec/helper/finder/security_group.rb
awspec-0.63.0 lib/awspec/helper/finder/security_group.rb
awspec-0.62.1 lib/awspec/helper/finder/security_group.rb
awspec-0.62.0 lib/awspec/helper/finder/security_group.rb
awspec-0.61.1 lib/awspec/helper/finder/security_group.rb
awspec-0.61.0 lib/awspec/helper/finder/security_group.rb
awspec-0.60.1 lib/awspec/helper/finder/security_group.rb