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

strip ARNs - AWS is sensitive to leading and trailing whitespace/cr/lf.

This commit is contained in:
hedgehog 2012-02-28 08:15:25 +11:00
parent 80ca32bfdd
commit 4d81b869bc
22 changed files with 26 additions and 26 deletions

View file

@ -53,7 +53,7 @@ module Fog
:auto_minor_version_upgrade => auto_upgrade, :auto_minor_version_upgrade => auto_upgrade,
:engine => engine, :engine => engine,
:engine_version => engine_version, :engine_version => engine_version,
:notification_topic_arn => notification_config['TopicArn'], :notification_topic_arn => (notification_config['TopicArn']).strip,
:port => port, :port => port,
:preferred_availablility_zone => zone, :preferred_availablility_zone => zone,
:preferred_maintenance_window => maintenance_window, :preferred_maintenance_window => maintenance_window,

View file

@ -12,7 +12,7 @@ module Fog
def end_element(name) def end_element(name)
case name case name
when 'SubscriptionArn', 'RequestId' when 'SubscriptionArn', 'RequestId'
@response[name] = @value.rstrip @response[name] = @value.strip
end end
end end

View file

@ -12,7 +12,7 @@ module Fog
def end_element(name) def end_element(name)
case name case name
when 'TopicArn', 'RequestId' when 'TopicArn', 'RequestId'
@response[name] = @value.rstrip @response[name] = @value.strip
end end
end end

View file

@ -13,12 +13,12 @@ module Fog
def end_element(name) def end_element(name)
case name case name
when "TopicArn", "Protocol", "SubscriptionArn", "Owner", "Endpoint" when "TopicArn", "Protocol", "SubscriptionArn", "Owner", "Endpoint"
@subscription[name] = @value.rstrip @subscription[name] = @value.strip
when "member" when "member"
@response['Subscriptions'] << @subscription @response['Subscriptions'] << @subscription
@subscription = {} @subscription = {}
when 'RequestId', 'NextToken' when 'RequestId', 'NextToken'
@response[name] = @value.rstrip @response[name] = @value.strip
end end
end end
end end

View file

@ -12,7 +12,7 @@ module Fog
def end_element(name) def end_element(name)
case name case name
when 'TopicArn' when 'TopicArn'
@response['Topics'] << @value @response['Topics'] << @value.strip
when 'NextToken', 'RequestId' when 'NextToken', 'RequestId'
response[name] = @value response[name] = @value
end end

View file

@ -12,7 +12,7 @@ module Fog
def end_element(name) def end_element(name)
case name case name
when 'SubscriptionArn', 'RequestId' when 'SubscriptionArn', 'RequestId'
@response[name] = @value.rstrip @response[name] = @value.strip
end end
end end

View file

@ -15,7 +15,7 @@ module Fog
when 'SessionToken', 'SecretAccessKey', 'Expiration', 'AccessKeyId' when 'SessionToken', 'SecretAccessKey', 'Expiration', 'AccessKeyId'
@response[name] = @value.strip @response[name] = @value.strip
when 'Arn', 'FederatedUserId' when 'Arn', 'FederatedUserId'
@response[name] = @value @response[name] = @value.strip
when 'PackedPolicySize' when 'PackedPolicySize'
@response[name] = @value @response[name] = @value
when 'RequestId' when 'RequestId'

View file

@ -36,14 +36,14 @@ module Fog
# Merge the Cache Security Group parameters with the normal options # Merge the Cache Security Group parameters with the normal options
request(sec_group_params.merge( request(sec_group_params.merge(
'Action' => 'CreateCacheCluster', 'Action' => 'CreateCacheCluster',
'CacheClusterId' => id, 'CacheClusterId' => id.strip,
'CacheNodeType' => options[:node_type] || 'cache.m1.large', 'CacheNodeType' => options[:node_type] || 'cache.m1.large',
'Engine' => options[:engine] || 'memcached', 'Engine' => options[:engine] || 'memcached',
'NumCacheNodes' => options[:num_nodes] || 1, 'NumCacheNodes' => options[:num_nodes] || 1,
'AutoMinorVersionUpgrade' => options[:auto_minor_version_upgrade], 'AutoMinorVersionUpgrade' => options[:auto_minor_version_upgrade],
'CacheParameterGroupName' => options[:parameter_group_name], 'CacheParameterGroupName' => options[:parameter_group_name],
'EngineVersion' => options[:engine_version], 'EngineVersion' => options[:engine_version],
'NotificationTopicArn' => options[:notification_topic_arn], 'NotificationTopicArn' => (options[:notification_topic_arn]).strip,
'Port' => options[:port], 'Port' => options[:port],
'PreferredAvailabilityZone' => options[:preferred_availablility_zone], 'PreferredAvailabilityZone' => options[:preferred_availablility_zone],
'PreferredMaintenanceWindow' => options[:preferred_maintenance_window], 'PreferredMaintenanceWindow' => options[:preferred_maintenance_window],

View file

@ -45,13 +45,13 @@ module Fog
# Merge the Cache Security Group parameters with the normal options # Merge the Cache Security Group parameters with the normal options
request(node_id_params.merge(sec_group_params.merge( request(node_id_params.merge(sec_group_params.merge(
'Action' => 'ModifyCacheCluster', 'Action' => 'ModifyCacheCluster',
'CacheClusterId' => id, 'CacheClusterId' => id.strip,
'ApplyImmediately' => options[:apply_immediately], 'ApplyImmediately' => options[:apply_immediately],
'NumCacheNodes' => options[:num_nodes], 'NumCacheNodes' => options[:num_nodes],
'AutoMinorVersionUpgrade' => options[:auto_minor_version_upgrade], 'AutoMinorVersionUpgrade' => options[:auto_minor_version_upgrade],
'CacheParameterGroupName' => options[:parameter_group_name], 'CacheParameterGroupName' => options[:parameter_group_name],
'EngineVersion' => options[:engine_version], 'EngineVersion' => options[:engine_version],
'NotificationTopicArn' => options[:notification_topic_arn], 'NotificationTopicArn' => (options[:notification_topic_arn]).strip,
'NotificationTopicStatus' => options[:notification_topic_status], 'NotificationTopicStatus' => options[:notification_topic_status],
'PreferredMaintenanceWindow' => options[:preferred_maintenance_window], 'PreferredMaintenanceWindow' => options[:preferred_maintenance_window],
:parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new :parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new

View file

@ -44,10 +44,10 @@ module Fog
data[:groups][group_name][:path] = path data[:groups][group_name][:path] = path
Excon::Response.new.tap do |response| Excon::Response.new.tap do |response|
response.body = { 'Group' => { response.body = { 'Group' => {
'GroupId' => data[:groups][group_name][:group_id], 'GroupId' => (data[:groups][group_name][:group_id]).strip,
'GroupName' => group_name, 'GroupName' => group_name,
'Path' => path, 'Path' => path,
'Arn' => data[:groups][group_name][:arn] }, 'Arn' => (data[:groups][group_name][:arn]).strip },
'RequestId' => Fog::AWS::Mock.request_id } 'RequestId' => Fog::AWS::Mock.request_id }
response.status = 200 response.status = 200
end end

View file

@ -47,7 +47,7 @@ module Fog
"UserId" => data[:users][user_name][:user_id], "UserId" => data[:users][user_name][:user_id],
"Path" => path, "Path" => path,
"UserName" => user_name, "UserName" => user_name,
"Arn" => data[:users][user_name][:arn] "Arn" => (data[:users][user_name][:arn]).strip
}, },
'RequestId' => Fog::AWS::Mock.request_id 'RequestId' => Fog::AWS::Mock.request_id
} }

View file

@ -48,7 +48,7 @@ module Fog
{ 'GroupId' => group[:group_id], { 'GroupId' => group[:group_id],
'GroupName' => name, 'GroupName' => name,
'Path' => group[:path], 'Path' => group[:path],
'Arn' => group[:arn] } 'Arn' => (group[:arn]).strip }
end, end,
'IsTruncated' => false, 'IsTruncated' => false,
'RequestId' => Fog::AWS::Mock.request_id } 'RequestId' => Fog::AWS::Mock.request_id }

View file

@ -51,7 +51,7 @@ module Fog
{ 'GroupId' => group[:group_id], { 'GroupId' => group[:group_id],
'GroupName' => name, 'GroupName' => name,
'Path' => group[:path], 'Path' => group[:path],
'Arn' => group[:arn] } 'Arn' => (group[:arn]).strip }
end, end,
'IsTruncated' => false, 'IsTruncated' => false,
'RequestId' => Fog::AWS::Mock.request_id 'RequestId' => Fog::AWS::Mock.request_id

View file

@ -46,7 +46,7 @@ module Fog
{ 'UserId' => data[:user_id], { 'UserId' => data[:user_id],
'Path' => data[:path], 'Path' => data[:path],
'UserName' => user, 'UserName' => user,
'Arn' => data[:arn] } 'Arn' => (data[:arn]).strip }
end, end,
'IsTruncated' => false, 'IsTruncated' => false,
'RequestId' => Fog::AWS::Mock.request_id } 'RequestId' => Fog::AWS::Mock.request_id }

View file

@ -21,7 +21,7 @@ module Fog
request({ request({
'Action' => 'ConfirmSubscription', 'Action' => 'ConfirmSubscription',
'Token' => token, 'Token' => token,
'TopicArn' => arn, 'TopicArn' => arn.strip,
:parser => Fog::Parsers::AWS::SNS::ConfirmSubscription.new :parser => Fog::Parsers::AWS::SNS::ConfirmSubscription.new
}.merge!(options)) }.merge!(options))
end end

View file

@ -17,7 +17,7 @@ module Fog
def delete_topic(arn) def delete_topic(arn)
request({ request({
'Action' => 'DeleteTopic', 'Action' => 'DeleteTopic',
'TopicArn' => arn, 'TopicArn' => arn.strip,
:parser => Fog::Parsers::AWS::SNS::DeleteTopic.new :parser => Fog::Parsers::AWS::SNS::DeleteTopic.new
}) })
end end

View file

@ -17,7 +17,7 @@ module Fog
def get_topic_attributes(arn) def get_topic_attributes(arn)
request({ request({
'Action' => 'GetTopicAttributes', 'Action' => 'GetTopicAttributes',
'TopicArn' => arn, 'TopicArn' => arn.strip,
:parser => Fog::Parsers::AWS::SNS::GetTopicAttributes.new :parser => Fog::Parsers::AWS::SNS::GetTopicAttributes.new
}) })
end end

View file

@ -19,7 +19,7 @@ module Fog
def list_subscriptions_by_topic(arn, options = {}) def list_subscriptions_by_topic(arn, options = {})
request({ request({
'Action' => 'ListSubscriptionsByTopic', 'Action' => 'ListSubscriptionsByTopic',
'TopicArn' => arn, 'TopicArn' => arn.strip,
:parser => Fog::Parsers::AWS::SNS::ListSubscriptions.new :parser => Fog::Parsers::AWS::SNS::ListSubscriptions.new
}.merge!(options)) }.merge!(options))
end end

View file

@ -22,7 +22,7 @@ module Fog
request({ request({
'Action' => 'Publish', 'Action' => 'Publish',
'Message' => message, 'Message' => message,
'TopicArn' => arn, 'TopicArn' => arn.strip,
:parser => Fog::Parsers::AWS::SNS::Publish.new :parser => Fog::Parsers::AWS::SNS::Publish.new
}.merge!(options)) }.merge!(options))
end end

View file

@ -21,7 +21,7 @@ module Fog
'Action' => 'SetTopicAttributes', 'Action' => 'SetTopicAttributes',
'AttributeName' => attribute_name, 'AttributeName' => attribute_name,
'AttributeValue' => attribute_value, 'AttributeValue' => attribute_value,
'TopicArn' => arn, 'TopicArn' => arn.strip,
:parser => Fog::Parsers::AWS::SNS::SetTopicAttributes.new :parser => Fog::Parsers::AWS::SNS::SetTopicAttributes.new
}) })
end end

View file

@ -21,7 +21,7 @@ module Fog
'Action' => 'Subscribe', 'Action' => 'Subscribe',
'Endpoint' => endpoint, 'Endpoint' => endpoint,
'Protocol' => protocol, 'Protocol' => protocol,
'TopicArn' => arn, 'TopicArn' => arn.strip,
:parser => Fog::Parsers::AWS::SNS::Subscribe.new :parser => Fog::Parsers::AWS::SNS::Subscribe.new
}) })
end end

View file

@ -17,7 +17,7 @@ module Fog
def unsubscribe(arn) def unsubscribe(arn)
request({ request({
'Action' => 'Unsubscribe', 'Action' => 'Unsubscribe',
'SubscriptionArn' => arn, 'SubscriptionArn' => arn.strip,
:parser => Fog::Parsers::AWS::SNS::Unsubscribe.new :parser => Fog::Parsers::AWS::SNS::Unsubscribe.new
}) })
end end