mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
modify db snapshot attribute api implementation
This commit is contained in:
parent
f00473554d
commit
fd48293a43
3 changed files with 57 additions and 0 deletions
24
lib/fog/aws/parsers/rds/modify_db_snapshot_attribute.rb
Normal file
24
lib/fog/aws/parsers/rds/modify_db_snapshot_attribute.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module RDS
|
||||
class ModifyDbSnapshotAttribute < Fog::Parsers::Base
|
||||
def reset
|
||||
@response = { 'ModifyDbSnapshotAttributeResult' => {}, 'ResponseMetadata' => {} }
|
||||
end
|
||||
|
||||
def start_element(name, attrs = [])
|
||||
super
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'RequestId'
|
||||
@response['ResponseMetadata'][name] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -29,6 +29,7 @@ module Fog
|
|||
request :describe_db_snapshots
|
||||
request :create_db_snapshot
|
||||
request :delete_db_snapshot
|
||||
request :modify_db_snapshot_attribute
|
||||
|
||||
request :create_db_parameter_group
|
||||
request :delete_db_parameter_group
|
||||
|
|
32
lib/fog/aws/requests/rds/modify_db_snapshot_attribute.rb
Normal file
32
lib/fog/aws/requests/rds/modify_db_snapshot_attribute.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class RDS
|
||||
class Real
|
||||
require 'fog/aws/parsers/rds/modify_db_snapshot_attribute'
|
||||
|
||||
# Modify db snapshot attributes
|
||||
#
|
||||
# ==== Parameters
|
||||
# * db_snapshot_identifier<~String> - Id of snapshot to modify
|
||||
# * attributes<~Hash>:
|
||||
# * 'Add.MemberId'<~Array> - One or more account ids to grant rds create permission to
|
||||
# * 'Remove.MemberId'<~Array> - One or more account ids to revoke rds create permission from
|
||||
#
|
||||
# {Amazon API Reference}[http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_ModifyDBSnapshotAttribute.html]
|
||||
#
|
||||
def modify_db_snapshot_attribute(db_snapshot_identifier, attributes)
|
||||
params = {}
|
||||
params.merge!(Fog::AWS.indexed_param('ValuesToAdd.member.%d', attributes['Add.MemberId'] || []))
|
||||
params.merge!(Fog::AWS.indexed_param('ValuesToRemove.member.%d', attributes['Remove.MemberId'] || []))
|
||||
request({
|
||||
'Action' => 'ModifyDBSnapshotAttribute',
|
||||
'DBSnapshotIdentifier' => db_snapshot_identifier,
|
||||
:idempotent => true,
|
||||
'AttributeName' => "restore",
|
||||
:parser => Fog::Parsers::AWS::RDS::ModifyDbSnapshotAttribute.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue