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

whitespace

This commit is contained in:
Aaron Suggs 2012-02-25 18:55:16 -05:00
parent 198e2d3447
commit b0e357f71e
4 changed files with 22 additions and 23 deletions

View file

@ -9,15 +9,15 @@ module Fog
# http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
# ==== Parameters
# * DBInstanceIdentifier <~String> - name of the db instance to modify
#
#
# * AllocatedStorage <~Integer> Storage space, in GB
# * AutoMinorVersionUpgrade <~Boolean> Indicates that minor version upgrades will be applied automatically to the DB Instance during the maintenance window
# * AutoMinorVersionUpgrade <~Boolean> Indicates that minor version upgrades will be applied automatically to the DB Instance during the maintenance window
# * AvailabilityZone <~String> The availability zone to create the instance in
# * BackupRetentionPeriod <~Integer> 0-8 The number of days to retain automated backups.
# * DBInstanceClass <~String> The new compute and memory capacity of the DB Instance
# * DBName <~String> The name of the database to create when the DB Instance is created
# * DBParameterGroupName <~String> The name of the DB Parameter Group to apply to this DB Instance
# * DBSecurityGroups <~Array> A list of DB Security Groups to authorize on this DB Instance
# * DBParameterGroupName <~String> The name of the DB Parameter Group to apply to this DB Instance
# * DBSecurityGroups <~Array> A list of DB Security Groups to authorize on this DB Instance
# * Engine <~String> The name of the database engine to be used for this instance.
# * EngineVersion <~String> The version number of the database engine to use.
# * MasterUsername <~String> The db master user
@ -30,11 +30,11 @@ module Fog
# * response<~Excon::Response>:
# * body<~Hash>:
def create_db_instance(db_name, options={})
if security_groups = options.delete('DBSecurityGroups')
options.merge!(Fog::AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
end
request({
'Action' => 'CreateDBInstance',
'DBInstanceIdentifier' => db_name,
@ -58,7 +58,7 @@ module Fog
#return response
raise Fog::AWS::RDS::IdentifierTaken.new("DBInstanceAlreadyExists #{response.body.to_s}")
end
# These are the required parameters according to the API
required_params = %w{AllocatedStorage DBInstanceClass Engine MasterUserPassword MasterUsername }
required_params.each do |key|
@ -72,7 +72,7 @@ module Fog
raise Fog::AWS::RDS::NotFound.new("The request must contain the parameter #{key}")
end
end
data =
{
"DBInstanceIdentifier"=> db_name,
@ -103,8 +103,8 @@ module Fog
# "LatestRestorableTime" => nil,
"AvailabilityZone" => options["AvailabilityZone"]
}
self.data[:servers][db_name] = data
response.body = {
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },

View file

@ -21,7 +21,7 @@ module Fog
if opts[:max_records]
params['MaxRecords'] = opts[:max_records]
end
request({
'Action' => 'DescribeDBInstances',
:parser => Fog::Parsers::AWS::RDS::DescribeDBInstances.new
@ -35,7 +35,7 @@ module Fog
def describe_db_instances(identifier=nil, opts={})
response = Excon::Response.new
server_set = []
if identifier
if identifier
if server = self.data[:servers][identifier]
server_set << server
else
@ -44,7 +44,7 @@ module Fog
else
server_set = self.data[:servers].values
end
server_set.each do |server|
case server["DBInstanceStatus"]
when "creating"
@ -78,10 +78,10 @@ module Fog
if server["PendingModifiedValues"]
server["DBInstanceStatus"] = 'modifying'
end
end
end
end
response.status = 200
response.body = {
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
@ -89,7 +89,7 @@ module Fog
}
response
end
end
end

View file

@ -28,11 +28,11 @@ module Fog
class Mock
def describe_db_security_groups(opts={})
def describe_db_security_groups(opts={})
response = Excon::Response.new
sec_group_set = []
if opts.is_a?(String)
sec_group_name = opts
sec_group_name = opts
if sec_group = self.data[:security_groups][sec_group_name]
sec_group_set << sec_group
else
@ -41,7 +41,7 @@ module Fog
else
sec_group_set = self.data[:security_groups].values
end
sec_group_set.each do |sec_group|
sec_group["IPRanges"].each do |iprange|
if iprange["Status"] == "authorizing" || iprange["Status"] == "revoking"
@ -53,7 +53,7 @@ module Fog
end
end
end
sec_group["EC2SecurityGroups"].each do |ec2_secg|
if ec2_secg["Status"] == "authorizing" || iprange["Status"] == "revoking"
ec2_secg[:tmp] ||= Time.now + Fog::Mock.delay * 2
@ -65,7 +65,7 @@ module Fog
end
end
end
response.status = 200
response.body = {
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },

View file

@ -10,7 +10,6 @@ Shindo.tests('AWS::RDS | instance requests', ['aws', 'rds']) do
@db_final_snapshot_id = "fog-final-snapshot"
tests('success') do
#
tests("#create_db_instance").formats(AWS::RDS::Formats::CREATE_DB_INSTANCE) do
result = Fog::AWS[:rds].create_db_instance(@db_instance_id, 'AllocatedStorage' => 5,