mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws] segregate mock data by region
This commit is contained in:
parent
a291086009
commit
cdca74ff6a
2 changed files with 53 additions and 47 deletions
|
@ -67,48 +67,50 @@ module Fog
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def self.data
|
def self.data
|
||||||
@data ||= Hash.new do |hash, key|
|
@data ||= Hash.new do |hash, region|
|
||||||
owner_id = Fog::AWS::Mock.owner_id
|
owner_id = Fog::AWS::Mock.owner_id
|
||||||
hash[key] = {
|
hash[region] = Hash.new do |hash, key|
|
||||||
:deleted_at => {},
|
hash[key] = {
|
||||||
:addresses => {},
|
:deleted_at => {},
|
||||||
:instances => {},
|
:addresses => {},
|
||||||
:key_pairs => {},
|
:instances => {},
|
||||||
:limits => { :addresses => 5 },
|
:key_pairs => {},
|
||||||
:owner_id => owner_id,
|
:limits => { :addresses => 5 },
|
||||||
:security_groups => {
|
:owner_id => owner_id,
|
||||||
'default' => {
|
:security_groups => {
|
||||||
'groupDescription' => 'default group',
|
'default' => {
|
||||||
'groupName' => 'default',
|
'groupDescription' => 'default group',
|
||||||
'ipPermissions' => [
|
'groupName' => 'default',
|
||||||
{
|
'ipPermissions' => [
|
||||||
'groups' => [{'groupName' => 'default', 'userId' => owner_id}],
|
{
|
||||||
'fromPort' => -1,
|
'groups' => [{'groupName' => 'default', 'userId' => owner_id}],
|
||||||
'toPort' => -1,
|
'fromPort' => -1,
|
||||||
'ipProtocol' => 'icmp',
|
'toPort' => -1,
|
||||||
'ipRanges' => []
|
'ipProtocol' => 'icmp',
|
||||||
},
|
'ipRanges' => []
|
||||||
{
|
},
|
||||||
'groups' => [{'groupName' => 'default', 'userId' => owner_id}],
|
{
|
||||||
'fromPort' => 0,
|
'groups' => [{'groupName' => 'default', 'userId' => owner_id}],
|
||||||
'toPort' => 65535,
|
'fromPort' => 0,
|
||||||
'ipProtocol' => 'tcp',
|
'toPort' => 65535,
|
||||||
'ipRanges' => []
|
'ipProtocol' => 'tcp',
|
||||||
},
|
'ipRanges' => []
|
||||||
{
|
},
|
||||||
'groups' => [{'groupName' => 'default', 'userId' => owner_id}],
|
{
|
||||||
'fromPort' => 0,
|
'groups' => [{'groupName' => 'default', 'userId' => owner_id}],
|
||||||
'toPort' => 65535,
|
'fromPort' => 0,
|
||||||
'ipProtocol' => 'udp',
|
'toPort' => 65535,
|
||||||
'ipRanges' => []
|
'ipProtocol' => 'udp',
|
||||||
}
|
'ipRanges' => []
|
||||||
],
|
}
|
||||||
'ownerId' => owner_id
|
],
|
||||||
}
|
'ownerId' => owner_id
|
||||||
},
|
}
|
||||||
:snapshots => {},
|
},
|
||||||
:volumes => {}
|
:snapshots => {},
|
||||||
}
|
:volumes => {}
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -120,7 +122,8 @@ module Fog
|
||||||
|
|
||||||
def initialize(options={})
|
def initialize(options={})
|
||||||
@aws_access_key_id = options[:aws_access_key_id]
|
@aws_access_key_id = options[:aws_access_key_id]
|
||||||
@data = self.class.data[@aws_access_key_id]
|
@region = options[:region] || 'us-east-1'
|
||||||
|
@data = self.class.data[@region][@aws_access_key_id]
|
||||||
@owner_id = @data[:owner_id]
|
@owner_id = @data[:owner_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -74,10 +74,12 @@ module Fog
|
||||||
include Utils
|
include Utils
|
||||||
|
|
||||||
def self.data
|
def self.data
|
||||||
@data ||= Hash.new do |hash, key|
|
@data ||= Hash.new do |hash, region|
|
||||||
hash[key] = {
|
hash[region] = Hash.new do |hash, key|
|
||||||
:buckets => {}
|
hash[key] = {
|
||||||
}
|
:buckets => {}
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,7 +91,8 @@ module Fog
|
||||||
|
|
||||||
def initialize(options={})
|
def initialize(options={})
|
||||||
@aws_access_key_id = options[:aws_access_key_id]
|
@aws_access_key_id = options[:aws_access_key_id]
|
||||||
@data = self.class.data[@aws_access_key_id]
|
@region = options[:region] || 'us-east-1'
|
||||||
|
@data = self.class.data[@region][@aws_access_key_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
def signature(params)
|
def signature(params)
|
||||||
|
|
Loading…
Add table
Reference in a new issue