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

[aws|auto_scaling] DRY out ARNs in mocks.

This commit is contained in:
Nick Osborn 2012-09-22 18:51:49 +01:00
parent 3306eaf765
commit a5701e9e19
4 changed files with 6 additions and 5 deletions

View file

@ -240,6 +240,7 @@ module Fog
@use_iam_profile = options[:use_iam_profile] @use_iam_profile = options[:use_iam_profile]
setup_credentials(options) setup_credentials(options)
@region = options[:region] || 'us-east-1' @region = options[:region] || 'us-east-1'
@owner_id = Fog::AWS::Mock.owner_id
unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region) unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}" raise ArgumentError, "Unknown region: #{@region.inspect}"

View file

@ -88,7 +88,7 @@ module Fog
raise Fog::AWS::AutoScaling::ValidationError.new('Launch configuration name not found - null') raise Fog::AWS::AutoScaling::ValidationError.new('Launch configuration name not found - null')
end end
data[:auto_scaling_groups][auto_scaling_group_name] = { data[:auto_scaling_groups][auto_scaling_group_name] = {
'AutoScalingGroupARN' => "arn:aws:autoscaling:eu-west-1:000000000000:autoScalingGroup:00000000-0000-0000-0000-000000000000:autoScalingGroupName/#{auto_scaling_group_name}", 'AutoScalingGroupARN' => Fog::AWS::Mock.arn('autoscaling', @owner_id, "autoScalingGroup:00000000-0000-0000-0000-000000000000:autoScalingGroupName/#{auto_scaling_group_name}", @region),
'AutoScalingGroupName' => launch_configuration_name, 'AutoScalingGroupName' => launch_configuration_name,
'AvailabilityZones' => availability_zones.to_a, 'AvailabilityZones' => availability_zones.to_a,
'CreatedTime' => Time.now.utc, 'CreatedTime' => Time.now.utc,

View file

@ -90,7 +90,7 @@ module Fog
'InstanceType' => instance_type, 'InstanceType' => instance_type,
'KernelId' => nil, 'KernelId' => nil,
'KeyName' => nil, 'KeyName' => nil,
'LaunchConfigurationARN' => "arn:aws:autoscaling:eu-west-1:000000000000:launchConfiguration:00000000-0000-0000-0000-000000000000:launchConfigurationName/#{launch_configuration_name}", 'LaunchConfigurationARN' => Fog::AWS::Mock.arn('autoscaling', @owner_id, "launchConfiguration:00000000-0000-0000-0000-000000000000:launchConfigurationName/#{launch_configuration_name}", @region),
'LaunchConfigurationName' => launch_configuration_name, 'LaunchConfigurationName' => launch_configuration_name,
'RamdiskId' => nil, 'RamdiskId' => nil,
'SecurityGroups' => [], 'SecurityGroups' => [],

View file

@ -65,7 +65,7 @@ module Fog
'AutoScalingGroupName' => auto_scaling_group_name, 'AutoScalingGroupName' => auto_scaling_group_name,
'Cooldown' => 0, 'Cooldown' => 0,
'MinAdjustmentStep' => 0, 'MinAdjustmentStep' => 0,
'PolicyARN' => "arn:aws:autoscaling:eu-west-1:000000000000:scalingPolicy:00000000-0000-0000-0000-000000000000:autoScalingGroupName/#{auto_scaling_group_name}:policyName/#{policy_name}", 'PolicyARN' => Fog::AWS::Mock.arn('autoscaling', @owner_id, "scalingPolicy:00000000-0000-0000-0000-000000000000:autoScalingGroupName/#{auto_scaling_group_name}:policyName/#{policy_name}", @region),
'PolicyName' => policy_name, 'PolicyName' => policy_name,
'ScalingAdjustment' => scaling_adjustment 'ScalingAdjustment' => scaling_adjustment
}.merge!(options) }.merge!(options)