From 60ace7f28f68b2c2cea7b915dd469c667cd6975e Mon Sep 17 00:00:00 2001 From: Eugene Howe Date: Fri, 10 Jul 2015 11:56:16 -0400 Subject: [PATCH] encrypted storage on rds --- lib/fog/aws/models/rds/server.rb | 23 ++++++++++--------- .../aws/requests/rds/create_db_instance.rb | 2 +- tests/models/rds/server_tests.rb | 6 +++++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/fog/aws/models/rds/server.rb b/lib/fog/aws/models/rds/server.rb index 20ebe0503..e0d22a8de 100644 --- a/lib/fog/aws/models/rds/server.rb +++ b/lib/fog/aws/models/rds/server.rb @@ -116,27 +116,28 @@ module Fog options = { 'AllocatedStorage' => allocated_storage, 'AutoMinorVersionUpgrade' => auto_minor_version_upgrade, + 'AvailabilityZone' => availability_zone, 'BackupRetentionPeriod' => backup_retention_period, + 'DBInstanceClass' => flavor_id, + 'DBInstanceIdentifier' => id, 'DBName' => db_name, 'DBParameterGroupName' => parameter_group_name || attributes['DBParameterGroupName'], 'DBSecurityGroups' => security_group_names, - 'DBInstanceIdentifier' => id, - 'AvailabilityZone' => availability_zone, - 'DBInstanceClass' => flavor_id, - 'Port' => port || attributes['Port'], + 'DBSubnetGroupName' => db_subnet_group_name, 'Engine' => engine, 'EngineVersion' => engine_version, + 'StorageEncrypted' => storage_encrypted, 'Iops' => iops, - 'MasterUsername' => master_username, - 'MasterUserPassword' => password || attributes['MasterUserPassword'], - 'PreferredMaintenanceWindow' => preferred_maintenance_window, - 'PreferredBackupWindow' => preferred_backup_window, - 'MultiAZ' => multi_az, 'LicenseModel' => license_model, - 'DBSubnetGroupName' => db_subnet_group_name, + 'MasterUserPassword' => password || attributes['MasterUserPassword'], + 'MasterUsername' => master_username, + 'MultiAZ' => multi_az, + 'Port' => port || attributes['Port'], + 'PreferredBackupWindow' => preferred_backup_window, + 'PreferredMaintenanceWindow' => preferred_maintenance_window, 'PubliclyAccessible' => publicly_accessible, - 'VpcSecurityGroups' => vpc_security_groups, 'StorageType' => storage_type, + 'VpcSecurityGroups' => vpc_security_groups, } options.delete_if {|key, value| value.nil?} diff --git a/lib/fog/aws/requests/rds/create_db_instance.rb b/lib/fog/aws/requests/rds/create_db_instance.rb index 3d6f66e74..4da4b60fa 100644 --- a/lib/fog/aws/requests/rds/create_db_instance.rb +++ b/lib/fog/aws/requests/rds/create_db_instance.rb @@ -104,7 +104,7 @@ module Fog "PreferredMaintenanceWindow" => options["PreferredMaintenanceWindow"] || "mon:04:30-mon:05:00", "PubliclyAccessible" => !!options["PubliclyAccessible"], "ReadReplicaDBInstanceIdentifiers" => [], - "StorageEncrypted" => false, + "StorageEncrypted" => options["StorageEncrypted"] || false, "StorageType" => options["StorageType"] || "standard", "VpcSecurityGroups" => options["VpcSecurityGroups"], } diff --git a/tests/models/rds/server_tests.rb b/tests/models/rds/server_tests.rb index fbd7294bf..2005e3b93 100644 --- a/tests/models/rds/server_tests.rb +++ b/tests/models/rds/server_tests.rb @@ -2,8 +2,14 @@ Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do model_tests(Fog::AWS[:rds].servers, rds_default_server_params) do # We'll need this later; create it early to avoid waiting @instance_with_final_snapshot = Fog::AWS[:rds].servers.create(rds_default_server_params.merge(:id => uniq_id("fog-snapshot-test"), :backup_retention_period => 1)) + @instance_with_encrypted_storage = Fog::AWS[:rds].servers.create(rds_default_server_params.merge(:storage_encrypted => true)) @instance.wait_for(20*60) { ready? } + @instance_with_encrypted_storage.wait_for(20*60) { ready? } + + tests("#storage_encrypted") do + returns(true) { @instance_with_encrypted_storage.storage_encrypted } + end test('#read_replica_identifiers is []') do returns([]) { @instance.read_replica_identifiers }