1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Parse elasticache configuration endpoint from response

This commit is contained in:
Frederick Cheung 2015-04-26 19:20:55 +01:00
parent 377d74b0ca
commit 9f0ba1ce30
2 changed files with 16 additions and 3 deletions

View file

@ -23,6 +23,7 @@ module Fog
attribute :cache_subnet_group_name, :aliases => 'CacheSubnetGroupName'
attribute :vpc_security_groups, :aliases => 'VpcSecurityGroups', :type => :array
attribute :s3_snapshot_location, :aliases => 'SnapshotArns', :type => :array
attribute :configuration_endpoint, :aliases => 'ConfigurationEndpoint'
attr_accessor :parameter_group_name

View file

@ -14,7 +14,8 @@ module Fog
@cache_cluster = {
'CacheSecurityGroups' => [],
'CacheNodes' => [],
'CacheParameterGroup' => {}
'CacheParameterGroup' => {},
'ConfigurationEndpoint' => {}
}
end
@ -24,6 +25,7 @@ module Fog
when 'CacheSecurityGroup'; then @security_group = {}
when 'CacheNode'; then @cache_node = {}
when 'PendingModifiedValues'; then @pending_values = {}
when 'ConfigurationEndpoint'; then @configuration_endpoint = {}
end
end
@ -49,6 +51,8 @@ module Fog
@cache_cluster[name] = DateTime.parse(value)
when 'CacheSecurityGroup'
@cache_cluster["#{name}s"] << @security_group unless @security_group.empty?
when 'ConfigurationEndpoint'
@cache_cluster['ConfigurationEndpoint'] = @configuration_endpoint
when 'CacheSecurityGroupName', 'Status', 'CacheSubnetGroupName'
@cache_cluster[name] = value
when 'CacheNode'
@ -57,8 +61,16 @@ module Fog
when'PendingModifiedValues'
@cache_cluster[name] = @pending_values
@pending_values = nil
when 'CacheNodeCreateTime', 'CacheNodeStatus', 'Address',
'ParameterGroupStatus', 'Port', 'CacheNodeId'
when 'Port', 'Address'
if @cache_node
@cache_node[name] = value ? value.strip : name
elsif @pending_values
@pending_values[name] = value ? value.strip : name
elsif @configuration_endpoint
@configuration_endpoint[name] = value ? value.strip : name
end
when 'CacheNodeCreateTime', 'CacheNodeStatus',
'ParameterGroupStatus', 'CacheNodeId'
if @cache_node
@cache_node[name] = value ? value.strip : name
elsif @pending_values