Sha256: 60a18652b2fc435cd0d34c1aa3b63334dc4cd7b543eedca161aed0c76a7b4e8a

Contents?: true

Size: 1.84 KB

Versions: 31

Compression:

Stored size: 1.84 KB

Contents

module Awspec::Helper
  module Finder
    module Rds
      def find_rds(id)
        begin
          res = rds_client.describe_db_instances({
                                                   db_instance_identifier: id
                                                 })
        rescue
          res = rds_client.describe_db_instances({
                                                   filters: [{ name: 'db-instance-id', values: [id] }]
                                                 })
        end
        res.db_instances.single_resource(id)
      end

      def select_rds_by_vpc_id(vpc_id)
        res = rds_client.describe_db_instances
        res.db_instances.select do |db_instance|
          db_instance.db_subnet_group.vpc_id == vpc_id
        end
      end

      def select_all_rds_db_parameters(parameter_group)
        parameters = {}
        res = rds_client.describe_db_parameters({
                                                  db_parameter_group_name: parameter_group
                                                })
        loop do
          res.parameters.each do |param|
            parameters[param.parameter_name] = param.parameter_value
          end
          (res.next_page? && res = res.next_page) || break
        end
        parameters
      end

      def select_all_rds_db_cluster_parameters(parameter_group)
        parameters = {}
        res = rds_client.describe_db_cluster_parameters({
                                                          db_cluster_parameter_group_name: parameter_group
                                                        })
        loop do
          res.parameters.each do |param|
            parameters[param.parameter_name] = param.parameter_value
          end
          (res.respond_to?(:next_page?) && res.next_page? && res = res.next_page) || break
        end
        parameters
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

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