Sha256: e5c22ee851e9cb4006d36820c224c60f60291b599a8c558179ce6f1d06a68a49

Contents?: true

Size: 1.37 KB

Versions: 76

Compression:

Stored size: 1.37 KB

Contents

require 'fog/aws/models/rds/log_file'

module Fog
  module AWS
    class RDS
      class LogFiles < Fog::Collection
        attribute :filters
        attribute :rds_id
        model Fog::AWS::RDS::LogFile

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        # This method deliberately returns only a single page of results
        def all(filters_arg = filters)
          filters.merge!(filters_arg)

          result = service.describe_db_log_files(rds_id, filters).body['DescribeDBLogFilesResult']
          filters[:marker] = result['Marker']
          load(result['DBLogFiles'])
        end

        def each(filters_arg = filters)
          if block_given?
            begin
              page = self.all(filters_arg)
              # We need to explicitly use the base 'each' method here on the page, otherwise we get infinite recursion
              base_each = Fog::Collection.instance_method(:each)
              base_each.bind(page).call { |log_file| yield log_file }
            end while self.filters[:marker]
          end
          self
        end

        def get(file_name=nil)
          if file_name
            matches = self.select {|log_file| log_file.name.upcase == file_name.upcase}
            return matches.first unless matches.empty?
          end
        rescue Fog::AWS::RDS::NotFound
        end
      end
    end
  end
end

Version data entries

76 entries across 74 versions & 3 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.29.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.28.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.27.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.26.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.25.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.24.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.23.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.22.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.21.1 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.21.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.20.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.19.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.18.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.17.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.16.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.15.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.14.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.13.0 lib/fog/aws/models/rds/log_files.rb
fog-aws-3.12.0 lib/fog/aws/models/rds/log_files.rb