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,
:engine => engine,
:engine_version => engine_version,
:notification_topic_arn => notification_config['TopicArn'],
:notification_topic_arn => (notification_config['TopicArn']).strip,
:port => port,
:preferred_availablility_zone => zone,
:preferred_maintenance_window => maintenance_window,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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