mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[AWS RDS] Added describe db engine versions and describe db reserved instances. Changed the signed params version to 2011-04-01 from 2010-07-28.
This commit is contained in:
parent
dfb586af5c
commit
4ecfb87419
7 changed files with 199 additions and 2 deletions
|
@ -28,6 +28,7 @@ module Fog
|
|||
attribute :db_security_groups, :aliases => 'DBSecurityGroups'
|
||||
attribute :db_parameter_groups, :aliases => 'DBParameterGroups'
|
||||
attribute :backup_retention_period, :aliases => 'BackupRetentionPeriod', :type => :integer
|
||||
attribute :license_model, :aliases => 'LicenseModel'
|
||||
|
||||
attr_accessor :password, :parameter_group_name, :security_group_names, :port
|
||||
|
||||
|
@ -89,7 +90,8 @@ module Fog
|
|||
'MasterUserPassword' => password,
|
||||
'PreferredMaintenanceWindow' => preferred_maintenance_window,
|
||||
'PreferredBackupWindow' => preferred_backup_window,
|
||||
'MultiAZ' => multi_az
|
||||
'MultiAZ' => multi_az,
|
||||
'LicenseModel' => license_model
|
||||
}
|
||||
options.delete_if {|key, value| value.nil?}
|
||||
|
||||
|
|
35
lib/fog/aws/parsers/rds/db_engine_version_parser.rb
Normal file
35
lib/fog/aws/parsers/rds/db_engine_version_parser.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module RDS
|
||||
|
||||
class DBEngineVersionParser < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@db_engine_version = fresh_engine_version
|
||||
end
|
||||
|
||||
def fresh_engine_version
|
||||
{}
|
||||
end
|
||||
|
||||
def start_element(name, attrs = [])
|
||||
super
|
||||
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'DBEngineDescription' then @db_engine_version['DBEngineDescription'] = @value
|
||||
when 'DBEngineVersionDescription' then @db_engine_version['DBEngineVersionDescription'] = @value
|
||||
when 'DBParameterGroupFamily' then @db_engine_version['DBParameterGroupFamily'] = @value
|
||||
when 'DBEngineVersionIdentifier' then @db_engine_version['DBEngineVersionIdentifier'] = @value
|
||||
when 'Engine' then @db_engine_version['Engine'] = @value
|
||||
when 'EngineVersion' then @db_engine_version['EngineVersion'] = @value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
39
lib/fog/aws/parsers/rds/describe_db_engine_versions.rb
Normal file
39
lib/fog/aws/parsers/rds/describe_db_engine_versions.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module RDS
|
||||
|
||||
require 'fog/aws/parsers/rds/db_engine_version_parser'
|
||||
|
||||
class DescribeDBEngineVersions < Fog::Parsers::AWS::RDS::DBEngineVersionParser
|
||||
|
||||
def reset
|
||||
@response = { 'DescribeDBEngineVersionsResult' => {'DBEngineVersions' => []}, 'ResponseMetadata' => {} }
|
||||
super
|
||||
end
|
||||
|
||||
def start_element(name, attrs = [])
|
||||
super
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'DBEngineVersion' then
|
||||
@response['DescribeDBEngineVersionsResult']['DBEngineVersions'] << @db_engine_version
|
||||
@db_engine_version = fresh_engine_version
|
||||
when 'Marker'
|
||||
@response['DescribeDBEngineVersionsResult']['Marker'] = @value
|
||||
when 'RequestId'
|
||||
@response['ResponseMetadata'][name] = @value
|
||||
else
|
||||
super
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
43
lib/fog/aws/parsers/rds/describe_db_reserved_instances.rb
Normal file
43
lib/fog/aws/parsers/rds/describe_db_reserved_instances.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module RDS
|
||||
|
||||
class DescribeDBReservedInstances < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@reserved_instance = {}
|
||||
@response = { 'ReservedDBInstances' => [] }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'ReservedDBInstanceId', 'ReservedDBInstancesOfferingId', 'DBInstanceClass', 'ProductDescription', 'State'
|
||||
@reserved_instance[name] = @value
|
||||
when 'Duration', 'DBInstanceCount'
|
||||
@reserved_instance[name] = @value.to_i
|
||||
when 'FixedPrice', 'UsagePrice'
|
||||
@reserved_instance[name] = @value.to_f
|
||||
when 'ReservedDBInstance'
|
||||
@response['ReservedDBInstances'] << @reserved_instance
|
||||
@reserved_instance = {}
|
||||
when 'Marker'
|
||||
@response[name] = @value
|
||||
when 'MultiAZ'
|
||||
if @value == 'false'
|
||||
@reserved_instance[name] = false
|
||||
else
|
||||
@reserved_instance[name] = true
|
||||
end
|
||||
when 'StartTime'
|
||||
@reserved_instance[name] = Time.parse(@value)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -15,6 +15,8 @@ module Fog
|
|||
request :delete_db_instance
|
||||
request :reboot_db_instance
|
||||
request :create_db_instance_read_replica
|
||||
request :describe_db_engine_versions
|
||||
request :describe_db_reserved_instances
|
||||
|
||||
request :describe_db_snapshots
|
||||
request :create_db_snapshot
|
||||
|
@ -123,7 +125,7 @@ module Fog
|
|||
:host => @host,
|
||||
:path => @path,
|
||||
:port => @port,
|
||||
:version => '2010-07-28'
|
||||
:version => '2011-04-01' #'2010-07-28'
|
||||
}
|
||||
)
|
||||
|
||||
|
|
34
lib/fog/aws/requests/rds/describe_db_engine_versions.rb
Normal file
34
lib/fog/aws/requests/rds/describe_db_engine_versions.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class RDS
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/rds/describe_db_engine_versions'
|
||||
|
||||
def describe_db_engine_versions(opts={})
|
||||
params = {}
|
||||
params['DBParameterGroupFamily'] = opts[:db_parameter_group_family] if opts[:db_parameter_group_family]
|
||||
params['DefaultOnly'] = opts[:default_only] if opts[:default_only]
|
||||
params['Engine'] = opts[:engine] if opts[:engine]
|
||||
params['EngineVersion'] = opts[:engine_version] if opts[:engine_version]
|
||||
params['Marker'] = opts[:marker] if opts[:marker]
|
||||
params['MaxRecords'] = opts[:max_records] if opts[:max_records]
|
||||
|
||||
request({
|
||||
'Action' => 'DescribeDBEngineVersions',
|
||||
:parser => Fog::Parsers::AWS::RDS::DescribeDBEngineVersions.new
|
||||
}.merge(params))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def describe_db_engine_versions(opts={})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
42
lib/fog/aws/requests/rds/describe_db_reserved_instances.rb
Normal file
42
lib/fog/aws/requests/rds/describe_db_reserved_instances.rb
Normal file
|
@ -0,0 +1,42 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class RDS
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/rds/describe_db_reserved_instances'
|
||||
|
||||
# Describe all or specified load db instances
|
||||
# http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBInstances.html
|
||||
# ==== Parameters
|
||||
# * DBInstanceIdentifier <~String> - ID of instance to retrieve information for. if absent information for all instances is returned
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
def describe_db_reserved_instances(identifier=nil, opts={})
|
||||
params = {}
|
||||
params['ReservedDBInstanceId'] = identifier if identifier
|
||||
if opts[:marker]
|
||||
params['Marker'] = opts[:marker]
|
||||
end
|
||||
if opts[:max_records]
|
||||
params['MaxRecords'] = opts[:max_records]
|
||||
end
|
||||
|
||||
request({
|
||||
'Action' => 'DescribeReservedDBInstances',
|
||||
:parser => Fog::Parsers::AWS::RDS::DescribeDBReservedInstances.new
|
||||
}.merge(params))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def describe_db_instances(identifier=nil, opts={})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue