mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add db identifier to parser, use it for log_file model
This commit is contained in:
parent
8f2539a942
commit
860628dc5f
2 changed files with 19 additions and 10 deletions
|
@ -5,9 +5,20 @@ module Fog
|
|||
|
||||
class DescribeDBLogFiles < Fog::Parsers::Base
|
||||
|
||||
attr_reader :rds_id
|
||||
|
||||
def initialize(rds_id)
|
||||
@rds_id = rds_id
|
||||
super()
|
||||
end
|
||||
|
||||
def reset
|
||||
@response = { 'DescribeDBLogFilesResult' => {'DBLogFiles' => []}, 'ResponseMetadata' => {} }
|
||||
@db_log_file = {}
|
||||
fresh_log_file
|
||||
end
|
||||
|
||||
def fresh_log_file
|
||||
@db_log_file = {'DBInstanceIdentifier' => @rds_id}
|
||||
end
|
||||
|
||||
def start_element(name, attrs = [])
|
||||
|
@ -16,16 +27,14 @@ module Fog
|
|||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'LastWritten' then @db_log_file['LastWritten'] = Time.at(value.to_i / 1000)
|
||||
when 'LogFileName' then @db_log_file['LogFileName'] = value
|
||||
when 'Size' then @db_log_file['Size'] = value.to_i
|
||||
when 'LastWritten' then @db_log_file[name] = Time.at(value.to_i / 1000)
|
||||
when 'LogFileName' then @db_log_file[name] = value
|
||||
when 'Size' then @db_log_file[name] = value.to_i
|
||||
when 'DescribeDBLogFilesDetails'
|
||||
@response['DescribeDBLogFilesResult']['DBLogFiles'] << @db_log_file
|
||||
@db_log_file = {}
|
||||
when 'Marker'
|
||||
@response['DescribeDBLogFilesResult']['Marker'] = value
|
||||
when 'RequestId'
|
||||
@response['ResponseMetadata'][name] = value
|
||||
fresh_log_file
|
||||
when 'Marker' then @response['DescribeDBLogFilesResult'][name] = value
|
||||
when 'RequestId' then @response['ResponseMetadata'][name] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ module Fog
|
|||
|
||||
request({
|
||||
'Action' => 'DescribeDBLogFiles',
|
||||
:parser => Fog::Parsers::AWS::RDS::DescribeDBLogFiles.new
|
||||
:parser => Fog::Parsers::AWS::RDS::DescribeDBLogFiles.new(rds_id)
|
||||
}.merge(params))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue