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

new properties, parser and model attributes

This commit is contained in:
Josh Lane 2015-05-08 11:12:07 -07:00
parent 0c79f2f836
commit c48dd760a9
4 changed files with 74 additions and 60 deletions

View file

@ -8,20 +8,24 @@ module Fog
attribute :auto_minor_version_upgrade, :aliases => 'AutoMinorVersionUpgrade'
attribute :availability_zone, :aliases => 'AvailabilityZone'
attribute :backup_retention_period, :aliases => 'BackupRetentionPeriod', :type => :integer
attribute :ca_certificate_id, :aliases => 'CACertificateIdentifier'
attribute :character_set_name, :aliases => 'CharacterSetName'
attribute :created_at, :aliases => 'InstanceCreateTime', :type => :time
attribute :db_name, :aliases => 'DBName'
attribute :db_parameter_groups, :aliases => 'DBParameterGroups'
attribute :db_security_groups, :aliases => 'DBSecurityGroups', :type => :array
attribute :db_subnet_group_name, :aliases => 'DBSubnetGroupName'
attribute :dbi_resource_id, :aliases => 'DbiResourceId'
attribute :endpoint, :aliases => 'Endpoint'
attribute :engine, :aliases => 'Engine'
attribute :engine_version, :aliases => 'EngineVersion'
attribute :flavor_id, :aliases => 'DBInstanceClass'
attribute :iops, :aliases => 'Iops'
attribute :iops, :aliases => 'Iops', :type => :integer
attribute :kms_key_id, :aliases => 'KmsKeyId'
attribute :last_restorable_time, :aliases => 'LatestRestorableTime', :type => :time
attribute :license_model, :aliases => 'LicenseModel'
attribute :master_username, :aliases => 'MasterUsername'
attribute :multi_az, :aliases => 'MultiAZ'
attribute :multi_az, :aliases => 'MultiAZ', :type => :boolean
attribute :pending_modified_values, :aliases => 'PendingModifiedValues'
attribute :preferred_backup_window, :aliases => 'PreferredBackupWindow'
attribute :preferred_maintenance_window, :aliases => 'PreferredMaintenanceWindow'
@ -29,7 +33,9 @@ module Fog
attribute :read_replica_identifiers, :aliases => 'ReadReplicaDBInstanceIdentifiers', :type => :array
attribute :read_replica_source, :aliases => 'ReadReplicaSourceDBInstanceIdentifier'
attribute :state, :aliases => 'DBInstanceStatus'
attribute :storage_encrypted, :aliases => 'StorageEncrypted', :type => :boolean
attribute :storage_type, :aliases => 'StorageType'
attribute :tde_credential_arn, :aliases => 'TdeCredentialArn'
attribute :vpc_security_groups, :aliases => 'VpcSecurityGroups', :type => :array
attr_accessor :password, :parameter_group_name, :security_group_names, :port

View file

@ -47,7 +47,8 @@ module Fog
'PreferredBackupWindow', 'PreferredMaintenanceWindow',
'AvailabilityZone', 'MasterUsername', 'DBName', 'LicenseModel',
'DBSubnetGroupName', 'StorageType', 'KmsKeyId', 'TdeCredentialArn',
'SecondaryAvailabilityZone', 'DbiResourceId'
'SecondaryAvailabilityZone', 'DbiResourceId', 'CACertificateIdentifier',
'CharacterSetName', 'DbiResourceId', 'LicenseModel', 'KmsKeyId'
@db_instance[name] = value
when 'MultiAZ', 'AutoMinorVersionUpgrade', 'PubliclyAccessible', 'StorageEncrypted'
@db_instance[name] = (value == 'true')
@ -61,14 +62,14 @@ module Fog
if @in_db_parameter_groups
@db_parameter_group[name] = value
end
when 'BackupRetentionPeriod'
when 'BackupRetentionPeriod', 'Iops', 'AllocatedStorage'
if @in_pending_modified_values
@pending_modified_values[name] = value.to_i
else
@db_instance[name] = value.to_i
end
when 'DBInstanceClass', 'EngineVersion', 'MasterUserPassword',
'MultiAZ', 'Iops', 'AllocatedStorage'
'MultiAZ'
if @in_pending_modified_values
@pending_modified_values[name] = value
else

View file

@ -6,14 +6,14 @@ class AWS
}
DB_AVAILABILITY_ZONE_OPTION = {
'Name' => String,
'ProvisionedIopsCapable' => Fog::Boolean
'Name' => String,
'ProvisionedIopsCapable' => Fog::Boolean
}
DB_PARAMETER_GROUP = {
'DBParameterGroupFamily' => String,
'DBParameterGroupName' => String,
'Description' => String
'DBParameterGroupFamily' => String,
'DBParameterGroupName' => String,
'Description' => String
}
CREATE_DB_PARAMETER_GROUP = {
'ResponseMetadata' => { 'RequestId' => String },
@ -32,7 +32,7 @@ class AWS
CREATE_DB_SECURITY_GROUP = BASIC.merge({
'CreateDBSecurityGroupResult' => {
'DBSecurityGroup' => DB_SECURITY_GROUP
'DBSecurityGroup' => DB_SECURITY_GROUP
}
})
@ -82,20 +82,20 @@ class AWS
}
ORDERABLE_DB_INSTANCE_OPTION = {
'MultiAZCapable' => Fog::Boolean,
'Engine' => String,
'LicenseModel' => String,
'ReadReplicaCapable' => Fog::Boolean,
'EngineVersion' => String,
'AvailabilityZones' => [DB_AVAILABILITY_ZONE_OPTION],
'DBInstanceClass' => String,
'Vpc' => Fog::Boolean
'MultiAZCapable' => Fog::Boolean,
'Engine' => String,
'LicenseModel' => String,
'ReadReplicaCapable' => Fog::Boolean,
'EngineVersion' => String,
'AvailabilityZones' => [DB_AVAILABILITY_ZONE_OPTION],
'DBInstanceClass' => String,
'Vpc' => Fog::Boolean
}
DESCRIBE_ORDERABLE_DB_INSTANCE_OPTION = BASIC.merge({
'DescribeOrderableDBInstanceOptionsResult' => {
'OrderableDBInstanceOptions' => [ORDERABLE_DB_INSTANCE_OPTION]
}
'DescribeOrderableDBInstanceOptionsResult' => {
'OrderableDBInstanceOptions' => [ORDERABLE_DB_INSTANCE_OPTION]
}
})
MODIFY_PARAMETER_GROUP = BASIC.merge({
@ -153,48 +153,55 @@ class AWS
}
INSTANCE = {
'AllocatedStorage' => Integer,
'AllocatedStorage' => Integer,
'AutoMinorVersionUpgrade' => Fog::Boolean,
'AvailabilityZone' => Fog::Nullable::String,
'BackupRetentionPeriod' => Integer,
'DBInstanceClass' => String,
'DBInstanceIdentifier' => String,
'DBInstanceStatus' => String,
'DBName' => Fog::Nullable::String,
'AvailabilityZone' => Fog::Nullable::String,
'BackupRetentionPeriod' => Integer,
'CACertificateIdentifier' => String,
'CharacterSetName' => Fog::Nullable::String,
'DbiResourceId' => Fog::Nullable::String,
'DBInstanceClass' => String,
'DBInstanceIdentifier' => String,
'DBInstanceStatus' => String,
'DBName' => Fog::Nullable::String,
'DBParameterGroups' => [{
'ParameterApplyStatus' => String,
'DBParameterGroupName' => String
}],
'ParameterApplyStatus' => String,
'DBParameterGroupName' => String
}],
'DBSecurityGroups' => [{
'Status' => String,
'DBSecurityGroupName' => String
}],
'DBSubnetGroupName' => Fog::Nullable::String,
'Status' => String,
'DBSecurityGroupName' => String
}],
'DBSubnetGroupName' => Fog::Nullable::String,
'PubliclyAccessible' => Fog::Boolean,
'Endpoint' => {
'Address' => Fog::Nullable::String,
'Port' => Fog::Nullable::Integer
'Port' => Fog::Nullable::Integer
},
'Engine' => String,
'EngineVersion' => String,
'InstanceCreateTime' => Fog::Nullable::Time,
'Iops' => Fog::Nullable::Integer,
'Engine' => String,
'EngineVersion' => String,
'InstanceCreateTime' => Fog::Nullable::Time,
'Iops' => Fog::Nullable::Integer,
'KmsKeyId' => Fog::Nullable::String,
'LatestRestorableTime' => Fog::Nullable::Time,
'LicenseModel' => String,
'MasterUsername' => String,
'MultiAZ' => Fog::Boolean,
'LicenseModel' => String,
'MasterUsername' => String,
'MultiAZ' => Fog::Boolean,
'PendingModifiedValues' => {
'BackupRetentionPeriod' => Fog::Nullable::Integer,
'DBInstanceClass' => Fog::Nullable::String,
'EngineVersion' => Fog::Nullable::String,
'MasterUserPassword' => Fog::Nullable::String,
'MultiAZ' => Fog::Nullable::String,
'MultiAZ' => Fog::Nullable::Boolean,
'AllocatedStorage' => Fog::Nullable::Integer,
'Port' => Fog::Nullable::Integer
},
'PreferredBackupWindow' => String,
'PreferredMaintenanceWindow' => String,
'ReadReplicaDBInstanceIdentifiers' => [Fog::Nullable::String]
'PreferredBackupWindow' => String,
'PreferredMaintenanceWindow' => String,
'ReadReplicaDBInstanceIdentifiers' => [Fog::Nullable::String],
'StorageType' => String,
'StorageEncrypted' => Fog::Boolean,
'TdeCredentialArn' => Fog::Nullable::String
}
REPLICA_INSTANCE = INSTANCE.merge({
@ -242,7 +249,7 @@ class AWS
PROMOTE_READ_REPLICA = BASIC.merge({
'PromoteReadReplicaResult' => {
'DBInstance' => INSTANCE
'DBInstance' => INSTANCE
}
})

View file

@ -1,6 +1,4 @@
Shindo.tests('AWS::RDS | instance requests', ['aws', 'rds']) do
# Disabled due to https://github.com/fog/fog/1546
pending
# random_differentiator
# Useful when rapidly re-running tests, so we don't have to wait
@ -9,20 +7,22 @@ Shindo.tests('AWS::RDS | instance requests', ['aws', 'rds']) do
@db_instance_id = "fog-test-#{suffix}"
@db_replica_id = "fog-replica-#{suffix}"
@db_snapshot_id = "fog-snapshot"
@db_final_snapshot_id = "fog-final-snapshot"
@db_snapshot_id = "fog-snapshot-#{suffix}"
@db_final_snapshot_id = "fog-final-snapshot-#{suffix}"
tests('success') do
tests("#create_db_instance").formats(AWS::RDS::Formats::CREATE_DB_INSTANCE) do
default_params = rds_default_server_params
result = Fog::AWS[:rds].create_db_instance(@db_instance_id,
'AllocatedStorage' => 5,
'DBInstanceClass' => 'db.m1.small',
'Engine' => 'mysql',
'EngineVersion' => '5.1.50',
'MasterUsername' => 'foguser',
'BackupRetentionPeriod' => 1,
'MasterUserPassword' => 'fogpassword').body
'AllocatedStorage' => default_params.fetch(:allocated_storage),
'DBInstanceClass' => default_params.fetch(:flavor_id),
'Engine' => default_params.fetch(:engine),
'EngineVersion' => default_params.fetch(:version),
'MasterUsername' => default_params.fetch(:master_username),
'BackupRetentionPeriod' => default_params.fetch(:backup_retention_period),
'MasterUserPassword' => default_params.fetch(:password)).body
instance = result['CreateDBInstanceResult']['DBInstance']
returns('creating') { instance['DBInstanceStatus'] }