From 0da02e4ec95600b4b03ba15b40b0fcfc5186808c Mon Sep 17 00:00:00 2001 From: David Vaz Date: Fri, 1 Jul 2016 16:17:21 +0530 Subject: [PATCH] implemented copy db snapshot parser --- lib/fog/aws/parsers/rds/copy_db_snapshot.rb | 32 ++++++++++++++++++++ lib/fog/aws/requests/rds/copy_db_snapshot.rb | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 lib/fog/aws/parsers/rds/copy_db_snapshot.rb diff --git a/lib/fog/aws/parsers/rds/copy_db_snapshot.rb b/lib/fog/aws/parsers/rds/copy_db_snapshot.rb new file mode 100644 index 000000000..81619a8b6 --- /dev/null +++ b/lib/fog/aws/parsers/rds/copy_db_snapshot.rb @@ -0,0 +1,32 @@ +module Fog + module Parsers + module AWS + module RDS + require 'fog/aws/parsers/rds/snapshot_parser' + + class CopyDBSnapshot < Fog::Parsers::AWS::RDS::SnapshotParser + def reset + @response = { 'CopyDBSnapshotResult' => {}, 'ResponseMetadata' => {} } + super + end + + def start_element(name, attrs = []) + super + end + + def end_element(name) + case name + when 'DBSnapshot' then + @response['CopyDBSnapshotResult']['DBSnapshot'] = @db_snapshot + @db_snapshot = fresh_snapshot + when 'RequestId' + @response['ResponseMetadata'][name] = value + else + super + end + end + end + end + end + end +end diff --git a/lib/fog/aws/requests/rds/copy_db_snapshot.rb b/lib/fog/aws/requests/rds/copy_db_snapshot.rb index f40ab5f6c..41f14a22a 100644 --- a/lib/fog/aws/requests/rds/copy_db_snapshot.rb +++ b/lib/fog/aws/requests/rds/copy_db_snapshot.rb @@ -22,7 +22,7 @@ module Fog 'SourceDBSnapshotIdentifier' => source_db_snapshot_identifier, 'TargetDBSnapshotIdentifier' => target_db_snapshot_identifier, 'CopyTags' => copy_tags, - :parser => Fog::Parsers::AWS::RDS::CreateDBSnapshot.new + :parser => Fog::Parsers::AWS::RDS::CopyDBSnapshot.new ) end end