def end_element(name)
case name
when 'AvailabilityZone', 'ClusterIdentifier', 'ClusterStatus', 'ClusterSubnetGroupName', 'DBName',
'MasterUsername', 'ModifyStatus', 'PreferredMaintenanceWindow', 'VpcId'
@cluster[name] = value
when 'ClusterCreateTime'
@cluster[name] = Time.parse(value)
when 'AllowVersionUpgrade', 'Encrypted', 'PubliclyAccessible'
@cluster[name] = (value == "true")
when 'Address'
@cluster['EndPoint'][name] = value
when 'Port'
@cluster['EndPoint'][name] = value.to_i
when 'NodeType', 'ClusterVersion'
if @in_pending_modified_values
@cluster['PendingModifiedValues'][name] = value
else
@cluster[name] = value
end
when 'NumberOfNodes', 'AutomatedSnapshotRetentionPeriod'
if @in_pending_modified_values
@cluster['PendingModifiedValues'][name] = value.to_i
else
@cluster[name] = value.to_i
end
when 'MasterUserPassword', 'ClusterType'
@cluster['PendingModifiedValues'][name] = value
when 'Status'
if @in_vpc_security_groups
@vpc_security_group[name] = value
elsif @in_cluster_security_groups
@cluster_security_group[name] = value
else
@cluster['RestoreStatus'][name] = value
end
when 'ParameterGroupName', 'ParameterApplyStatus'
@cluster_parameter_group[name] = value
when 'ClusterSecurityGroupName'
@cluster_security_group[name] = value
when 'VpcSecurityGroupId'
@vpc_security_group[name] = value
when 'SnapshotSizeInMegaBytes', 'ProgressInMegaBytes', 'ElapsedTimeInSeconds', 'EstimatedTimeToCompletionInSeconds'
@cluster['RestoreStatus'][name] = value.to_i
when 'CurrentRestoreRateInMegaBytesPerSecond'
@cluster['RestoreStatus'][name] = value.to_f
when 'ClusterSecurityGroups'
@in_cluster_security_groups = false
when 'VpcSecurityGroups'
@in_vpc_security_groups = false
when 'PendingModifiedValues'
@in_pending_modified_values = false
when 'ClusterParameterGroup'
@cluster['ClusterParameterGroups'] << {name => @cluster_parameter_group}
@cluster_parameter_group = {}
when 'ClusterSecurityGroup'
@cluster['ClusterSecurityGroups'] << {name => @cluster_security_group}
@cluster_security_group = {}
when 'VpcSecurityGroup'
@cluster['VpcSecurityGroups'] << {name => @vpc_security_group}
@vpc_security_group = {}
end
end