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
|
class DescribeDBLogFiles < Fog::Parsers::Base
|
||||||
|
|
||||||
|
attr_reader :rds_id
|
||||||
|
|
||||||
|
def initialize(rds_id)
|
||||||
|
@rds_id = rds_id
|
||||||
|
super()
|
||||||
|
end
|
||||||
|
|
||||||
def reset
|
def reset
|
||||||
@response = { 'DescribeDBLogFilesResult' => {'DBLogFiles' => []}, 'ResponseMetadata' => {} }
|
@response = { 'DescribeDBLogFilesResult' => {'DBLogFiles' => []}, 'ResponseMetadata' => {} }
|
||||||
@db_log_file = {}
|
fresh_log_file
|
||||||
|
end
|
||||||
|
|
||||||
|
def fresh_log_file
|
||||||
|
@db_log_file = {'DBInstanceIdentifier' => @rds_id}
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_element(name, attrs = [])
|
def start_element(name, attrs = [])
|
||||||
|
@ -16,16 +27,14 @@ module Fog
|
||||||
|
|
||||||
def end_element(name)
|
def end_element(name)
|
||||||
case name
|
case name
|
||||||
when 'LastWritten' then @db_log_file['LastWritten'] = Time.at(value.to_i / 1000)
|
when 'LastWritten' then @db_log_file[name] = Time.at(value.to_i / 1000)
|
||||||
when 'LogFileName' then @db_log_file['LogFileName'] = value
|
when 'LogFileName' then @db_log_file[name] = value
|
||||||
when 'Size' then @db_log_file['Size'] = value.to_i
|
when 'Size' then @db_log_file[name] = value.to_i
|
||||||
when 'DescribeDBLogFilesDetails'
|
when 'DescribeDBLogFilesDetails'
|
||||||
@response['DescribeDBLogFilesResult']['DBLogFiles'] << @db_log_file
|
@response['DescribeDBLogFilesResult']['DBLogFiles'] << @db_log_file
|
||||||
@db_log_file = {}
|
fresh_log_file
|
||||||
when 'Marker'
|
when 'Marker' then @response['DescribeDBLogFilesResult'][name] = value
|
||||||
@response['DescribeDBLogFilesResult']['Marker'] = value
|
when 'RequestId' then @response['ResponseMetadata'][name] = value
|
||||||
when 'RequestId'
|
|
||||||
@response['ResponseMetadata'][name] = value
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,7 +29,7 @@ module Fog
|
||||||
|
|
||||||
request({
|
request({
|
||||||
'Action' => 'DescribeDBLogFiles',
|
'Action' => 'DescribeDBLogFiles',
|
||||||
:parser => Fog::Parsers::AWS::RDS::DescribeDBLogFiles.new
|
:parser => Fog::Parsers::AWS::RDS::DescribeDBLogFiles.new(rds_id)
|
||||||
}.merge(params))
|
}.merge(params))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue