2013-08-30 04:17:19 -04:00
|
|
|
module Fog
|
|
|
|
module Parsers
|
|
|
|
module Redshift
|
|
|
|
module AWS
|
|
|
|
|
|
|
|
class DescribeReservedNodes < Fog::Parsers::Base
|
|
|
|
# :marker - (String)
|
|
|
|
# :reserved_nodes - (Array)
|
|
|
|
# :reserved_node_id - (String)
|
|
|
|
# :reserved_node_offering_id - (String)
|
|
|
|
# :node_type - (String)
|
|
|
|
# :start_time - (Time)
|
|
|
|
# :duration - (Integer)
|
|
|
|
# :fixed_price - (Numeric)
|
|
|
|
# :usage_price - (Numeric)
|
|
|
|
# :currency_code - (String)
|
|
|
|
# :node_count - (Integer)
|
|
|
|
# :state - (String)
|
|
|
|
# :offering_type - (String)
|
|
|
|
# :recurring_charges - (Array)
|
|
|
|
# :recurring_charge_amount - (Numeric)
|
|
|
|
# :recurring_charge_frequency - (String)
|
|
|
|
|
|
|
|
def reset
|
|
|
|
@response = { 'ReservedNodes' => [] }
|
|
|
|
end
|
|
|
|
|
|
|
|
def fresh_reserved_nodes
|
|
|
|
{'RecurringCharges' => []}
|
|
|
|
end
|
|
|
|
|
|
|
|
def start_element(name, attrs = [])
|
|
|
|
super
|
|
|
|
case name
|
|
|
|
when 'ReservedNodes'
|
|
|
|
@reserved_node = fresh_reserved_nodes
|
|
|
|
when 'RecurringCharges'
|
|
|
|
@recurring_charge = {}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def end_element(name)
|
|
|
|
super
|
|
|
|
case name
|
|
|
|
when 'Marker'
|
|
|
|
@response[name] = value
|
|
|
|
when 'Duration', 'NodeCount'
|
|
|
|
@reserved_node[name] = value.to_i
|
|
|
|
when 'StartTime'
|
|
|
|
@reserved_node[name] = Time.parse(value)
|
|
|
|
when 'FixedPrice', 'UsagePrice'
|
|
|
|
@reserved_node[name] = value.to_f
|
|
|
|
when 'CurrencyCode', 'OfferingType', 'NodeType', 'ReservedNodeOfferingId', 'ReservedNodeId', 'State'
|
|
|
|
@reserved_node[name] = value
|
|
|
|
when 'RecurringChargeAmount'
|
|
|
|
@recurring_charge[name] = value.to_f
|
|
|
|
when 'RecurringChargeFrequency'
|
|
|
|
@recurring_charge[name] = value
|
|
|
|
when 'RecurringCharge'
|
2013-09-02 00:23:04 -04:00
|
|
|
@reserved_node['RecurringCharges'] << {name => @recurring_charge}
|
2013-08-30 04:17:19 -04:00
|
|
|
@recurring_charge = {}
|
|
|
|
when 'ReservedNode'
|
2013-09-02 00:23:04 -04:00
|
|
|
@response['ReservedNodes'] << {name => @reserved_node}
|
2013-09-12 14:32:31 -04:00
|
|
|
@reserved_node = fresh_reserved_nodes
|
2013-08-30 04:17:19 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|