Class: Fog::AWS::RDS::LogFiles

Inherits:
Collection show all
Defined in:
lib/fog/aws/models/rds/log_files.rb

Instance Attribute Summary

Attributes inherited from Collection

#service

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #destroy, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

#initialize(attributes) ⇒ LogFiles

Returns a new instance of LogFiles.



13
14
15
16
# File 'lib/fog/aws/models/rds/log_files.rb', line 13

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

Instance Method Details

#all(filters = filters) ⇒ Object

This method deliberately returns only a single page of results



19
20
21
22
23
24
25
# File 'lib/fog/aws/models/rds/log_files.rb', line 19

def all(filters=filters)
  self.filters.merge!(filters)

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

#each(filters = filters) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/aws/models/rds/log_files.rb', line 27

def each(filters=filters)
  if block_given?
    begin
      page = self.all(filters)
      # 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

#get(file_name = nil) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/fog/aws/models/rds/log_files.rb', line 39

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