Class: Fog::AWS::RDS::Real

Inherits:
Object
  • Object
show all
Includes:
CredentialFetcher::ConnectionMethods
Defined in:
lib/fog/aws/rds.rb,
lib/fog/aws/requests/rds/describe_events.rb,
lib/fog/aws/requests/rds/copy_db_snapshot.rb,
lib/fog/aws/requests/rds/create_db_cluster.rb,
lib/fog/aws/requests/rds/delete_db_cluster.rb,
lib/fog/aws/requests/rds/create_db_instance.rb,
lib/fog/aws/requests/rds/create_db_snapshot.rb,
lib/fog/aws/requests/rds/delete_db_instance.rb,
lib/fog/aws/requests/rds/delete_db_snapshot.rb,
lib/fog/aws/requests/rds/modify_db_instance.rb,
lib/fog/aws/requests/rds/reboot_db_instance.rb,
lib/fog/aws/requests/rds/add_tags_to_resource.rb,
lib/fog/aws/requests/rds/describe_db_clusters.rb,
lib/fog/aws/requests/rds/promote_read_replica.rb,
lib/fog/aws/requests/rds/describe_db_instances.rb,
lib/fog/aws/requests/rds/describe_db_log_files.rb,
lib/fog/aws/requests/rds/describe_db_snapshots.rb,
lib/fog/aws/requests/rds/create_db_subnet_group.rb,
lib/fog/aws/requests/rds/delete_db_subnet_group.rb,
lib/fog/aws/requests/rds/describe_db_parameters.rb,
lib/fog/aws/requests/rds/list_tags_for_resource.rb,
lib/fog/aws/requests/rds/modify_db_subnet_group.rb,
lib/fog/aws/requests/rds/create_db_security_group.rb,
lib/fog/aws/requests/rds/delete_db_security_group.rb,
lib/fog/aws/requests/rds/create_db_parameter_group.rb,
lib/fog/aws/requests/rds/create_event_subscription.rb,
lib/fog/aws/requests/rds/delete_db_parameter_group.rb,
lib/fog/aws/requests/rds/delete_event_subscription.rb,
lib/fog/aws/requests/rds/describe_db_subnet_groups.rb,
lib/fog/aws/requests/rds/modify_db_parameter_group.rb,
lib/fog/aws/requests/rds/remove_tags_from_resource.rb,
lib/fog/aws/requests/rds/create_db_cluster_snapshot.rb,
lib/fog/aws/requests/rds/delete_db_cluster_snapshot.rb,
lib/fog/aws/requests/rds/describe_db_engine_versions.rb,
lib/fog/aws/requests/rds/describe_db_security_groups.rb,
lib/fog/aws/requests/rds/download_db_logfile_portion.rb,
lib/fog/aws/requests/rds/describe_db_parameter_groups.rb,
lib/fog/aws/requests/rds/describe_event_subscriptions.rb,
lib/fog/aws/requests/rds/modify_db_snapshot_attribute.rb,
lib/fog/aws/requests/rds/describe_db_cluster_snapshots.rb,
lib/fog/aws/requests/rds/describe_db_reserved_instances.rb,
lib/fog/aws/requests/rds/create_db_instance_read_replica.rb,
lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb,
lib/fog/aws/requests/rds/describe_engine_default_parameters.rb,
lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb,
lib/fog/aws/requests/rds/restore_db_instance_from_db_snapshot.rb,
lib/fog/aws/requests/rds/restore_db_instance_to_point_in_time.rb,
lib/fog/aws/requests/rds/describe_orderable_db_instance_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CredentialFetcher::ConnectionMethods

#refresh_credentials_if_expired

Constructor Details

#initialize(options = {}) ⇒ Real

Initialize connection to ELB

Notes

options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection

Examples

elb = ELB.new(
 :aws_access_key_id => your_aws_access_key_id,
 :aws_secret_access_key => your_aws_secret_access_key
)

Parameters

  • options<~Hash> - config arguments for connection. Defaults to {}.

    • region<~String> - optional region to use. For instance, ‘eu-west-1’, ‘us-east-1’ and etc.

Returns

  • ELB object with connection to AWS.



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/fog/aws/rds.rb', line 213

def initialize(options={})
  @use_iam_profile = options[:use_iam_profile]
  @instrumentor       = options[:instrumentor]
  @instrumentor_name  = options[:instrumentor_name] || 'fog.aws.rds'
  @connection_options     = options[:connection_options] || {}

  @region     = options[:region]      || 'us-east-1'
  @host       = options[:host]        || "rds.#{@region}.amazonaws.com"
  @path       = options[:path]        || '/'
  @persistent = options[:persistent]  || false
  @port       = options[:port]        || 443
  @scheme     = options[:scheme]      || 'https'
  @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
  @version    = options[:version] || '2014-10-31'

  setup_credentials(options)
end

Instance Attribute Details

#regionObject (readonly)

Returns the value of attribute region.



192
193
194
# File 'lib/fog/aws/rds.rb', line 192

def region
  @region
end

Instance Method Details

#add_tags_to_resource(rds_id, tags) ⇒ Object

adds tags to a database instance docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_AddTagsToResource.html

Parameters

  • rds_id <~String> - name of the RDS instance whose tags are to be retrieved

  • tags <~Hash> A Hash of (String) key-value pairs

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/aws/requests/rds/add_tags_to_resource.rb', line 13

def add_tags_to_resource(rds_id, tags)
  keys    = tags.keys.sort
  values  = keys.map { |key| tags[key] }
  resource_name = "arn:aws:rds:#{@region}:#{owner_id}:db:#{rds_id}"
  %w[us-gov-west-1 us-gov-east-1].include?(@region) ? resource_name.insert(7, '-us-gov') : resource_name
  request({
    'Action' => 'AddTagsToResource',
    'ResourceName' => resource_name,
    :parser => Fog::Parsers::AWS::RDS::Base.new
  }.merge(Fog::AWS.indexed_param('Tags.member.%d.Key', keys))
      .merge(Fog::AWS.indexed_param('Tags.member.%d.Value', values)))
end

#authorize_db_security_group_ingress(name, opts = {}) ⇒ Object

authorizes a db security group ingress docs.amazonwebservices.com/AmazonRDS/latest/APIReference/index.html?API_AuthorizeDBSecurityGroupIngress.html

Parameters

  • CIDRIP <~String> - The IP range to authorize

  • DBSecurityGroupName <~String> - The name for the DB Security Group.

  • EC2SecurityGroupName <~String> - Name of the EC2 Security Group to authorize.

  • EC2SecurityGroupOwnerId <~String> - AWS Account Number of the owner of the security group specified in the EC2SecurityGroupName parameter. The AWS Access Key ID is not an acceptable value.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb', line 17

def authorize_db_security_group_ingress(name, opts={})
  unless opts.key?('CIDRIP') || ((opts.key?('EC2SecurityGroupName') || opts.key?('EC2SecurityGroupId')) && opts.key?('EC2SecurityGroupOwnerId'))
    raise ArgumentError, 'Must specify CIDRIP, or one of EC2SecurityGroupName or EC2SecurityGroupId, and EC2SecurityGroupOwnerId'
  end

  request({
    'Action'  => 'AuthorizeDBSecurityGroupIngress',
    :parser   => Fog::Parsers::AWS::RDS::AuthorizeDBSecurityGroupIngress.new,
    'DBSecurityGroupName' => name
  }.merge(opts))
end

#copy_db_snapshot(source_db_snapshot_identifier, target_db_snapshot_identifier, copy_tags = false) ⇒ Object

Copy a db snapshot

Parameters

  • source_db_snapshot_identifier<~String> - Id of db snapshot

  • target_db_snapshot_identifier<~String> - Desired Id of the db snapshot copy

  • ‘copy_tags’<~Boolean> - true to copy all tags from the source DB snapshot to the target DB snapshot; otherwise false.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

Amazon API Reference



19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/rds/copy_db_snapshot.rb', line 19

def copy_db_snapshot(source_db_snapshot_identifier, target_db_snapshot_identifier, copy_tags = false)
  request(
    'Action'                     => 'CopyDBSnapshot',
    'SourceDBSnapshotIdentifier' => source_db_snapshot_identifier,
    'TargetDBSnapshotIdentifier' => target_db_snapshot_identifier,
    'CopyTags'                   => copy_tags,
    :parser                      => Fog::Parsers::AWS::RDS::CopyDBSnapshot.new
  )
end

#create_db_cluster(cluster_name, options = {}) ⇒ Object

Create a db cluster

Parameters ====

  • AvailabilityZones<~Array> - A list of EC2 Availability Zones that instances in the DB cluster can be created in

  • BackupRetentionPeriod<~String> - The number of days for which automated backups are retained

  • CharacterSetName<~String> - A value that indicates that the DB cluster should be associated with the specified CharacterSet

  • DatabaseName<~String> - The name for your database of up to 8 alphanumeric characters. If you do not provide a name, Amazon RDS will not create a database in the DB cluster you are creating

  • DBClusterIdentifier<~String> - The DB cluster identifier. This parameter is stored as a lowercase string

  • DBClusterParameterGroupName<~String> - The name of the DB cluster parameter group to associate with this DB cluster

  • DBSubnetGroupName<~String> - A DB subnet group to associate with this DB cluster

  • Engine<~String> - The name of the database engine to be used for this DB cluster

  • EngineVersion<~String> - The version number of the database engine to use

  • KmsKeyId<~String> - The KMS key identifier for an encrypted DB cluster

  • MasterUsername<~String> - The name of the master user for the client DB cluster

  • MasterUserPassword<~String> - The password for the master database user

  • OptionGroupName<~String> - A value that indicates that the DB cluster should be associated with the specified option group

  • Port<~Integer> - The port number on which the instances in the DB cluster accept connections

  • PreferredBackupWindow<~String> - The daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter

  • PreferredMaintenanceWindow<~String> - The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC)

  • StorageEncrypted<~Boolean> - Specifies whether the DB cluster is encrypted

  • Tags<~Array> - A list of tags

  • VpcSecurityGroups<~Array> - A list of EC2 VPC security groups to associate with this DB cluster

Returns ====

  • response<~Excon::Response>:

    • body<~Hash>:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fog/aws/requests/rds/create_db_cluster.rb', line 36

def create_db_cluster(cluster_name, options={})
  if security_groups = options.delete('VpcSecurityGroups')
    options.merge!(Fog::AWS.indexed_param('VpcSecurityGroupIds.member.%d', [*security_groups]))
  end

  request({
    'Action'              => 'CreateDBCluster',
    'DBClusterIdentifier' => cluster_name,
    :parser               => Fog::Parsers::AWS::RDS::CreateDBCluster.new,
  }.merge(options))
end

#create_db_cluster_snapshot(identifier, name) ⇒ Object

create a snapshot of a db cluster docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBClusterSnapshot.html

Parameters ====

  • DBClusterIdentifier<~String> - The identifier of the DB cluster to create a snapshot for

  • DBClusterSnapshotIdentifier<~String> - The identifier of the DB cluster snapshot

  • Tags<~Array> - The tags to be assigned to the DB cluster snapshot

Returns ====

  • response<~Excon::Response>:

    • body<~Hash>:



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/rds/create_db_cluster_snapshot.rb', line 19

def create_db_cluster_snapshot(identifier, name)
  request(
    'Action'                      => 'CreateDBClusterSnapshot',
    'DBClusterIdentifier'         => identifier,
    'DBClusterSnapshotIdentifier' => name,
    :parser                       => Fog::Parsers::AWS::RDS::CreateDBClusterSnapshot.new
  )
end

#create_db_instance(db_name, options = {}) ⇒ Excon::Response

Create a db instance

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

  • 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

  • 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.

  • Iops (Integer)

    IOPS rate

  • MasterUsername (String)

    The db master user

  • MasterUserPassword (String)

    The new password for the DB Instance master user

  • MultiAZ (Boolean)

    Specifies if the DB Instance is a Multi-AZ deployment

  • Port (Integer)

    The port number on which the database accepts connections.

  • PreferredBackupWindow (String)

    The daily time range during which automated backups are created if automated backups are enabled

  • PreferredMaintenanceWindow (String)

    The weekly time range (in UTC) during which system maintenance can occur, which may result in an outage

  • DBSubnetGroupName (String)

    The name, if any, of the VPC subnet for this RDS instance

  • PubliclyAccessible (Boolean)

    Whether an RDS instance inside of the VPC subnet should have a public-facing endpoint

  • VpcSecurityGroups (Array)

    A list of VPC Security Groups to authorize on this DB instance

  • StorageType (string)

    Specifies storage type to be associated with the DB Instance. Valid values: standard | gp2 | io1

Returns:

  • (Excon::Response)

    :

    • body [Hash]:

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fog/aws/requests/rds/create_db_instance.rb', line 36

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

  if vpc_security_groups = options.delete('VpcSecurityGroups')
    options.merge!(Fog::AWS.indexed_param('VpcSecurityGroupIds.member.%d', [*vpc_security_groups]))
  end

  request({
    'Action'               => 'CreateDBInstance',
    'DBInstanceIdentifier' => db_name,
    :parser                => Fog::Parsers::AWS::RDS::CreateDBInstance.new,
  }.merge(options))
end

#create_db_instance_read_replica(instance_identifier, source_identifier, options = {}) ⇒ Object

create a read replica db instance docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_CreateDBInstanceReadReplica.html

Parameters

  • DBInstanceIdentifier <~String> - name of the db instance to create

  • SourceDBInstanceIdentifier <~String> - name of the db instance that will be the source. Must have backup retention on

  • 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

  • DBInstanceClass <~String> The new compute and memory capacity of the DB Instance

  • Port <~Integer> The port number on which the database accepts connections.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/rds/create_db_instance_read_replica.rb', line 19

def create_db_instance_read_replica(instance_identifier, source_identifier, options={})
  request({
    'Action'  => 'CreateDBInstanceReadReplica',
    'DBInstanceIdentifier' => instance_identifier,
    'SourceDBInstanceIdentifier' => source_identifier,
    :parser   => Fog::Parsers::AWS::RDS::CreateDBInstanceReadReplica.new,
  }.merge(options))
end

#create_db_parameter_group(group_name, group_family, description) ⇒ Object

create a database parameter group docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_CreateDBParameterGroup.html

Parameters

  • DBParameterGroupName <~String> - name of the parameter group

  • DBParameterGroupFamily <~String> - The DB parameter group family name. Current valid values: MySQL5.1 | MySQL5.5

  • Description <~String> - The description for the DB Parameter Grou

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/rds/create_db_parameter_group.rb', line 17

def create_db_parameter_group(group_name, group_family, description)
  request({
    'Action'  => 'CreateDBParameterGroup',
    'DBParameterGroupName' => group_name,
    'DBParameterGroupFamily' => group_family,
    'Description' => description,

    :parser   => Fog::Parsers::AWS::RDS::CreateDbParameterGroup.new
  })
end

#create_db_security_group(name, description = name) ⇒ Object

creates a db security group docs.amazonwebservices.com/AmazonRDS/latest/APIReference/index.html?API_CreateDBSecurityGroup.html

Parameters

  • DBSecurityGroupDescription <~String> - The description for the DB Security Group

  • DBSecurityGroupName <~String> - The name for the DB Security Group. This value is stored as a lowercase string. Must contain no more than 255 alphanumeric characters or hyphens. Must not be “Default”.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



15
16
17
18
19
20
21
22
# File 'lib/fog/aws/requests/rds/create_db_security_group.rb', line 15

def create_db_security_group(name, description = name)
  request({
    'Action'  => 'CreateDBSecurityGroup',
    'DBSecurityGroupName' => name,
    'DBSecurityGroupDescription' => description,
    :parser   => Fog::Parsers::AWS::RDS::CreateDBSecurityGroup.new
  })
end

#create_db_snapshot(identifier, name) ⇒ Object

creates a db snapshot docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_CreateDBSnapshot.html

Parameters

  • DBInstanceIdentifier <~String> - ID of instance to create snapshot for

  • DBSnapshotIdentifier <~String> - The identifier for the DB Snapshot. 1-255 alphanumeric or hyphen characters. Must start with a letter

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



15
16
17
18
19
20
21
22
# File 'lib/fog/aws/requests/rds/create_db_snapshot.rb', line 15

def create_db_snapshot(identifier, name)
  request({
    'Action'  => 'CreateDBSnapshot',
    'DBInstanceIdentifier' => identifier,
    'DBSnapshotIdentifier' => name,
    :parser   => Fog::Parsers::AWS::RDS::CreateDBSnapshot.new
  })
end

#create_db_subnet_group(name, subnet_ids, description = name) ⇒ Object

Creates a db subnet group docs.amazonwebservices.com/AmazonRDS/2012-01-15/APIReference/API_CreateDBSubnetGroup.html

Parameters

  • DBSubnetGroupName <~String> - The name for the DB Subnet Group. This value is stored as a lowercase string. Must contain no more than 255 alphanumeric characters or hyphens. Must not be “Default”.

  • SubnetIds <~Array> - The EC2 Subnet IDs for the DB Subnet Group.

  • DBSubnetGroupDescription <~String> - The description for the DB Subnet Group

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



16
17
18
19
20
21
22
23
# File 'lib/fog/aws/requests/rds/create_db_subnet_group.rb', line 16

def create_db_subnet_group(name, subnet_ids, description = name)
  params = { 'Action'  => 'CreateDBSubnetGroup',
    'DBSubnetGroupName' => name,
    'DBSubnetGroupDescription' => description,
    :parser   => Fog::Parsers::AWS::RDS::CreateDBSubnetGroup.new }
  params.merge!(Fog::AWS.indexed_param("SubnetIds.member", Array(subnet_ids)))
  request(params)
end

#create_event_subscription(options = {}) ⇒ Object

Subscribes a db instance to an SNS queue

Parameters

  • Enabled <~Boolean> - set to true to activate the subscription, set to false to create the subscription but not active it

  • EventCategories <~Array> - A list of event categories for a SourceType that you want to subscribe to

  • SnsTopicArn <~String> - The Amazon Resource Name of the SNS topic created for event notification

  • SourceIds <~Array> - The list of identifiers of the event sources for which events will be returned

  • SourceType <~String> - The type of source that will be generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. if this value is not specified, all events are returned

  • SubscriptionName <~String> - The name of the subscription

  • Tags <~Array> - A list of tags



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/aws/requests/rds/create_event_subscription.rb', line 18

def create_event_subscription(options={})
  if event_categories = options.delete("EventCategories")
    options.merge!(Fog::AWS.indexed_param('EventCategories.member.%d', [*event_categories]))
  end
  if source_ids = options.delete("SourceIds")
    options.merge!(Fog::AWS.indexed_param('SourceIds.member.%d', [*source_ids]))
  end
  if tags = options.delete("tags")
    options.merge!(Fog::AWS.indexed_param('Tags.member.%d', [*tags]))
  end

  request({
    "Action" => "CreateEventSubscription",
    :parser  => Fog::Parsers::AWS::RDS::CreateEventSubscription.new,
  }.merge(options))
end

#delete_db_cluster(identifier, snapshot_identifier, skip_snapshot = false) ⇒ Object

delete a database cluster

Parameters ====

  • DBClusterIdentifier <~String> - The DB cluster identifier for the DB cluster to be deleted

  • FinalDBSnapshotIdentifier <~String> - The DB cluster snapshot identifier of the new DB cluster snapshot created when SkipFinalSnapshot is set to false

  • SkipFinalSnapshot <~Boolean> - Determines whether a final DB cluster snapshot is created before the DB cluster is deleted

Returns ====

  • response<~Excon::Response>

    • body<~Hash>



20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/rds/delete_db_cluster.rb', line 20

def delete_db_cluster(identifier, snapshot_identifier, skip_snapshot = false)
  params = {}
  params["FinalDBSnapshotIdentifier"] = snapshot_identifier if snapshot_identifier
  request({
    'Action'              => 'DeleteDBCluster',
    'DBClusterIdentifier' => identifier,
    'SkipFinalSnapshot'   => skip_snapshot,
  }.merge(params))
end

#delete_db_cluster_snapshot(name) ⇒ Object

delete a db cluster snapshot docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DeleteDBClusterSnapshot.html

Parameters ====

  • DBClusterSnapshotIdentifier<~String> - The identifier of the DB cluster snapshot to delete

Returns ====

  • response<~Excon::Response>:

    • body<~Hash>:



17
18
19
20
21
22
23
# File 'lib/fog/aws/requests/rds/delete_db_cluster_snapshot.rb', line 17

def delete_db_cluster_snapshot(name)
  request(
    'Action'                      => 'DeleteDBClusterSnapshot',
    'DBClusterSnapshotIdentifier' => name,
    :parser                       => Fog::Parsers::AWS::RDS::DeleteDBClusterSnapshot.new
  )
end

#delete_db_instance(identifier, snapshot_identifier, skip_snapshot = false) ⇒ Object

delete a database instance docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DeleteDBInstance.html

Parameters

  • DBInstanceIdentifier <~String> - The DB Instance identifier for the DB Instance to be deleted.

  • FinalDBSnapshotIdentifier <~String> - The DBSnapshotIdentifier of the new DBSnapshot created when SkipFinalSnapshot is set to false

  • SkipFinalSnapshot <~Boolean> - Determines whether a final DB Snapshot is created before the DB Instance is deleted

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/rds/delete_db_instance.rb', line 17

def delete_db_instance(identifier, snapshot_identifier, skip_snapshot = false)
  params = {}
  params['FinalDBSnapshotIdentifier'] = snapshot_identifier if snapshot_identifier
  request({
    'Action'               => 'DeleteDBInstance',
    'DBInstanceIdentifier' => identifier,
    'SkipFinalSnapshot'    => skip_snapshot,
    :parser                => Fog::Parsers::AWS::RDS::DeleteDBInstance.new
  }.merge(params))
end

#delete_db_parameter_group(group_name) ⇒ Object

delete a database parameter group docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DeleteDBParameterGroup.html

Parameters

  • DBParameterGroupName <~String> - name of the parameter group. Must not be associated with any instances

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



14
15
16
17
18
19
20
21
# File 'lib/fog/aws/requests/rds/delete_db_parameter_group.rb', line 14

def delete_db_parameter_group(group_name)
  request({
    'Action'  => 'DeleteDBParameterGroup',
    'DBParameterGroupName' => group_name,

    :parser   => Fog::Parsers::AWS::RDS::DeleteDbParameterGroup.new
  })
end

#delete_db_security_group(name) ⇒ Object

deletes a db security group docs.amazonwebservices.com/AmazonRDS/latest/APIReference/index.html?API_DeleteDBSecurityGroup.html

Parameters

  • DBSecurityGroupName <~String> - The name for the DB Security Group to delete

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



14
15
16
17
18
19
20
# File 'lib/fog/aws/requests/rds/delete_db_security_group.rb', line 14

def delete_db_security_group(name)
  request({
    'Action'  => 'DeleteDBSecurityGroup',
    'DBSecurityGroupName' => name,
    :parser   => Fog::Parsers::AWS::RDS::DeleteDBSecurityGroup.new
  })
end

#delete_db_snapshot(name) ⇒ Object

delete a database snapshot docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DeleteDBSnapshot.html

Parameters

  • DBSnapshotIdentifier <~String> - name of the snapshot

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



14
15
16
17
18
19
20
21
# File 'lib/fog/aws/requests/rds/delete_db_snapshot.rb', line 14

def delete_db_snapshot(name)
  request({
    'Action'  => 'DeleteDBSnapshot',
    'DBSnapshotIdentifier' => name,

    :parser   => Fog::Parsers::AWS::RDS::DeleteDBSnapshot.new
  })
end

#delete_db_subnet_group(name) ⇒ Object

Deletes a db subnet group docs.aws.amazon.com/AmazonRDS/2013-09-09/APIReference/API_DeleteDBSubnetGroup.html

Parameters

  • DBSubnetGroupName <~String> - The name for the DB Subnet Group. This value is stored as a lowercase string. Must contain no more than 255 alphanumeric characters or hyphens. Must not be “Default”.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



14
15
16
17
18
19
# File 'lib/fog/aws/requests/rds/delete_db_subnet_group.rb', line 14

def delete_db_subnet_group(name)
  params = { 'Action'  => 'DeleteDBSubnetGroup',
    'DBSubnetGroupName' => name,
    :parser   => Fog::Parsers::AWS::RDS::DeleteDBSubnetGroup.new }
  request(params)
end

#delete_event_subscription(name) ⇒ Object

deletes an event subscription docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DeleteEventSubscription.html

Parameters

  • SubscriptionName <~String> - The name of the subscription to delete

Returns

  • response<~Excon::Response>:

    • body<~Hash>



15
16
17
18
19
20
21
# File 'lib/fog/aws/requests/rds/delete_event_subscription.rb', line 15

def delete_event_subscription(name)
  request({
    'Action'           => 'DeleteEventSubscription',
    'SubscriptionName' => name,
    :parser            => Fog::Parsers::AWS::RDS::DeleteEventSubscription.new
  })
end

#describe_db_cluster_snapshots(opts = {}) ⇒ Object

Describe all or specified db cluster snapshots docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBClusterSnapshots.html

Parameters ====

  • DBClusterIdentifier<~String> - A DB cluster identifier to retrieve the list of DB cluster snapshots for

  • DBClusterSnapshotIdentifier<~String> - A specific DB cluster snapshot identifier to describe

  • SnapshotType<~String> - The type of DB cluster snapshots that will be returned. Values can be automated or manual

Returns ====

  • response<~Excon::Response>:

    • body<~Hash>:



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/aws/requests/rds/describe_db_cluster_snapshots.rb', line 19

def describe_db_cluster_snapshots(opts={})
  params                                = {}
  params['SnapshotType']                = opts[:type]        if opts[:type]
  params['DBClusterIdentifier']         = opts[:identifier]  if opts[:identifier]
  params['DBClusterSnapshotIdentifier'] = opts[:snapshot_id] if opts[:snapshot_id]
  params['Marker']                      = opts[:marker]      if opts[:marker]
  params['MaxRecords']                  = opts[:max_records] if opts[:max_records]
  request({
    'Action' => 'DescribeDBClusterSnapshots',
    :parser  => Fog::Parsers::AWS::RDS::DescribeDBClusterSnapshots.new
  }.merge(params))
end

#describe_db_clusters(identifier = nil, opts = {}) ⇒ Object

Describe all or specified db clusters docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBClusters.html

Parameters ====

  • DBClusterIdentifier<~String> - The user-supplied DB cluster identifier

Returns ====

  • response<~Excon::Response>:

    • body<~Hash>:



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/rds/describe_db_clusters.rb', line 16

def describe_db_clusters(identifier=nil, opts={})
  params = {}
  params['DBClusterIdentifier'] = identifier         if identifier
  params['Marker']              = opts[:marker]      if opts[:marker]
  params['MaxRecords']          = opts[:max_records] if opts[:max_records]

  request({
    'Action' => 'DescribeDBClusters',
    :parser  => Fog::Parsers::AWS::RDS::DescribeDBClusters.new
  }.merge(params))
end

#describe_db_engine_versions(opts = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/aws/requests/rds/describe_db_engine_versions.rb', line 7

def describe_db_engine_versions(opts={})
  params = {}
  params['DBParameterGroupFamily'] = opts[:db_parameter_group_family] if opts[:db_parameter_group_family]
  params['DefaultOnly'] = opts[:default_only] if opts[:default_only]
  params['Engine'] = opts[:engine] if opts[:engine]
  params['EngineVersion'] = opts[:engine_version] if opts[:engine_version]
  params['Marker'] = opts[:marker] if opts[:marker]
  params['MaxRecords'] = opts[:max_records] if opts[:max_records]

  request({
    'Action'  => 'DescribeDBEngineVersions',
    :parser   => Fog::Parsers::AWS::RDS::DescribeDBEngineVersions.new
  }.merge(params))
end

#describe_db_instances(identifier = nil, opts = {}) ⇒ Object

Describe all or specified load db instances docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBInstances.html

Parameters

  • DBInstanceIdentifier <~String> - ID of instance to retrieve information for. if absent information for all instances is returned

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/rds/describe_db_instances.rb', line 14

def describe_db_instances(identifier=nil, opts={})
  params = {}
  params['DBInstanceIdentifier'] = identifier if identifier
  if opts[:marker]
    params['Marker'] = opts[:marker]
  end
  if opts[:max_records]
    params['MaxRecords'] = opts[:max_records]
  end

  request({
    'Action'  => 'DescribeDBInstances',
    :parser   => Fog::Parsers::AWS::RDS::DescribeDBInstances.new
  }.merge(params))
end

#describe_db_log_files(rds_id = nil, opts = {}) ⇒ Object

Describe log files for a DB instance docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBLogFiles.html

Parameters

  • DBInstanceIdentifier <~String> - ID of instance to retrieve information for. Required.

  • Options <~Hash> - Hash of options. Optional. The following keys are used:

    • :file_last_written <~Long> - Filter available log files for those written after this time. Optional.

    • :file_size <~Long> - Filters the available log files for files larger than the specified size. Optional.

    • :filename_contains <~String> - Filters the available log files for log file names that contain the specified string. Optional.

    • :marker <~String> - The pagination token provided in the previous request. If this parameter is specified the response includes only records beyond the marker, up to MaxRecords. Optional.

    • :max_records <~Integer> - The maximum number of records to include in the response. If more records exist, a pagination token is included in the response. Optional.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/aws/requests/rds/describe_db_log_files.rb', line 20

def describe_db_log_files(rds_id=nil, opts={})
  params = {}
  params['DBInstanceIdentifier'] = rds_id if rds_id
  params['Marker'] = opts[:marker] if opts[:marker]
  params['MaxRecords'] = opts[:max_records] if opts[:max_records]
  params['FilenameContains'] = opts[:filename_contains] if opts[:filename_contains]
  params['FileSize'] = opts[:file_size] if opts[:file_size]
  params['FileLastWritten'] = opts[:file_last_written] if opts[:file_last_written]

  request({
    'Action'  => 'DescribeDBLogFiles',
    :parser   => Fog::Parsers::AWS::RDS::DescribeDBLogFiles.new(rds_id)
  }.merge(params))
end

#describe_db_parameter_groups(name = nil, opts = {}) ⇒ Object

This API returns a list of DBParameterGroup descriptions. If a DBParameterGroupName is specified, the list will contain only the descriptions of the specified DBParameterGroup docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBParameterGroups.html

Parameters

  • DBParameterGroupName <~String> - The name of a specific database parameter group to return details for.

  • Source <~String> - The parameter types to return. user | system | engine-default

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/requests/rds/describe_db_parameter_groups.rb', line 15

def describe_db_parameter_groups(name=nil, opts={})
  params={}
  if opts[:marker]
    params['Marker'] = opts[:marker]
  end
  if name
    params['DBParameterGroupName'] = name
  end
  if opts[:max_records]
    params['MaxRecords'] = opts[:max_records]
  end

  request({
    'Action'  => 'DescribeDBParameterGroups',
    :parser   => Fog::Parsers::AWS::RDS::DescribeDBParameterGroups.new
  }.merge(params))
end

#describe_db_parameters(name, opts = {}) ⇒ Object

Describe parameters from a parameter group docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBParameters.html

Parameters

  • DBParameterGroupName <~String> - name of parameter group to retrieve parameters for

  • Source <~String> - The parameter types to return. user | system | engine-default

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/aws/requests/rds/describe_db_parameters.rb', line 15

def describe_db_parameters(name, opts={})
  params={}
  if opts[:marker]
    params['Marker'] = opts[:marker]
  end
  if opts[:source]
    params['Source'] = opts[:source]
  end
  if opts[:max_records]
    params['MaxRecords'] = opts[:max_records]
  end

  request({
    'Action'  => 'DescribeDBParameters',
    'DBParameterGroupName' => name,
    :parser   => Fog::Parsers::AWS::RDS::DescribeDBParameters.new
  }.merge(params))
end

#describe_db_reserved_instances(identifier = nil, opts = {}) ⇒ Object

Describe all or specified load db instances docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBInstances.html

Parameters

  • DBInstanceIdentifier <~String> - ID of instance to retrieve information for. if absent information for all instances is returned

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/rds/describe_db_reserved_instances.rb', line 14

def describe_db_reserved_instances(identifier=nil, opts={})
  params = {}
  params['ReservedDBInstanceId'] = identifier if identifier
  if opts[:marker]
    params['Marker'] = opts[:marker]
  end
  if opts[:max_records]
    params['MaxRecords'] = opts[:max_records]
  end

  request({
    'Action'  => 'DescribeReservedDBInstances',
    :parser   => Fog::Parsers::AWS::RDS::DescribeDBReservedInstances.new
  }.merge(params))
end

#describe_db_security_groups(opts = {}) ⇒ Object

Describe all or specified db security groups docs.amazonwebservices.com/AmazonRDS/latest/APIReference/index.html?API_DescribeDBSecurityGroups.html

Parameters

  • DBSecurityGroupName <~String> - The name of the DB Security Group to return details for.

  • Marker <~String> - An optional marker provided in the previous DescribeDBInstances request

  • MaxRecords <~Integer> - Max number of records to return (between 20 and 100)

Only one of DBInstanceIdentifier or DBSnapshotIdentifier can be specified

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



17
18
19
20
21
22
23
24
# File 'lib/fog/aws/requests/rds/describe_db_security_groups.rb', line 17

def describe_db_security_groups(opts={})
  opts = {'DBSecurityGroupName' => opts} if opts.is_a?(String)

  request({
    'Action'  => 'DescribeDBSecurityGroups',
    :parser   => Fog::Parsers::AWS::RDS::DescribeDBSecurityGroups.new
  }.merge(opts))
end

#describe_db_snapshots(opts = {}) ⇒ Object

Describe all or specified db snapshots docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBSnapshots.html

Parameters

  • DBInstanceIdentifier <~String> - ID of instance to retrieve information for. if absent information for all instances is returned

  • DBSnapshotIdentifier <~String> - ID of snapshot to retrieve information for. if absent information for all snapshots is returned

  • SnapshotType <~String> - type of snapshot to retrieve (automated|manual)

  • Marker <~String> - An optional marker provided in the previous DescribeDBInstances request

  • MaxRecords <~Integer> - Max number of records to return (between 20 and 100)

Only one of DBInstanceIdentifier or DBSnapshotIdentifier can be specified

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/aws/requests/rds/describe_db_snapshots.rb', line 19

def describe_db_snapshots(opts={})
  params = {}
  params['SnapshotType'] = opts[:type] if opts[:type]
  params['DBInstanceIdentifier'] = opts[:identifier] if opts[:identifier]
  params['DBSnapshotIdentifier'] = opts[:snapshot_id] if opts[:snapshot_id]
  params['Marker'] = opts[:marker] if opts[:marker]
  params['MaxRecords'] = opts[:max_records] if opts[:max_records]
  request({
    'Action'  => 'DescribeDBSnapshots',
    :parser   => Fog::Parsers::AWS::RDS::DescribeDBSnapshots.new
  }.merge(params))
end

#describe_db_subnet_groups(name = nil, opts = {}) ⇒ Object

This API returns a list of DBSubnetGroup descriptions. If a DBSubnetGroupName is specified, the list will contain only the descriptions of the specified DBSubnetGroup docs.amazonwebservices.com/AmazonRDS/2012-01-15/APIReference/API_DescribeDBSubnetGroups.html

Parameters

  • DBSubnetGroupName <~String> - The name of a specific database subnet group to return details for.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/requests/rds/describe_db_subnet_groups.rb', line 15

def describe_db_subnet_groups(name = nil, opts = {})
  params = {}
  if opts[:marker]
    params['Marker'] = opts[:marker]
  end
  if name
    params['DBSubnetGroupName'] = name
  end
  if opts[:max_records]
    params['MaxRecords'] = opts[:max_records]
  end

  request({
    'Action'  => 'DescribeDBSubnetGroups',
    :parser   => Fog::Parsers::AWS::RDS::DescribeDBSubnetGroups.new
  }.merge(params))
end

#describe_engine_default_parameters(family, opts = {}) ⇒ Object

Returns the default engine and system parameter information for the specified database engine docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeEngineDefaultParameters.html

Parameters ====

  • DBParameterGroupFamily<~String> - The name of the DB parameter group family

Returns ====

  • response<~Excon::Response>:

    • body<~Hash>:



17
18
19
20
21
22
23
# File 'lib/fog/aws/requests/rds/describe_engine_default_parameters.rb', line 17

def describe_engine_default_parameters(family, opts={})
  request({
    'Action'                 => 'DescribeEngineDefaultParameters',
    'DBParameterGroupFamily' => family,
    :parser                  => Fog::Parsers::AWS::RDS::DescribeEngineDefaultParameters.new,
  }.merge(opts))
end

#describe_event_subscriptions(options = {}) ⇒ Object

Describe all or specified event notifications docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeEventSubscriptions.html

Parameters

  • Marker <~String> - An optional pagination token provided by a previous DescribeOrderableDBInstanceOptions request

  • MaxRecords <~String> - The maximum number of records to include in the response (20-100)

  • SubscriptionName <~String> - The name of the RDS event notification subscription you want to describe

Returns

  • response<~Excon::Response>:

    • body<~Hash>



16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/rds/describe_event_subscriptions.rb', line 16

def describe_event_subscriptions(options={})
  if options[:max_records]
    params['MaxRecords'] = options[:max_records]
  end

  request({
    'Action' => 'DescribeEventSubscriptions',
    :parser  => Fog::Parsers::AWS::RDS::DescribeEventSubscriptions.new
  }.merge(options))
end

#describe_events(options = {}) ⇒ Object

  • :source_identifier <~String> - identifier of the event source

  • :source_type <~DateTime> - event type, one of:

    (db-instance | db-parameter-group | db-security-group | db-snapshot)
    

Returns

  • response <~Excon::Response>:

    • body <~Hash>



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/aws/requests/rds/describe_events.rb', line 28

def describe_events(options = {})
  request(
    'Action'            => 'DescribeEvents',
    'StartTime'         => options[:start_time],
    'EndTime'           => options[:end_time],
    'Duration'          => options[:duration],
    'Marker'            => options[:marker],
    'MaxRecords'        => options[:max_records],
    'SourceIdentifier'  => options[:source_identifier],
    'SourceType'        => options[:source_type],
    :parser => Fog::Parsers::AWS::RDS::EventListParser.new
  )
end

#describe_orderable_db_instance_options(engine = nil, opts = {}) ⇒ Object

Describe all or specified orderable db instances options docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeOrderableDBInstanceOptions.html

Parameters

  • Engine <~String> - The name of the engine to retrieve DB Instance options for. Required.

  • Options <~Hash> - Hash of options. Optional. The following keys are used:

    • :db_instance_class <~String> - Filter available offerings matching the specified DB Instance class. Optional.

    • :engine_version <~String> - Filters available offerings matching the specified engine version. Optional.

    • :license_model <~String> - Filters available offerings matching the specified license model. Optional.

    • :marker <~String> - The pagination token provided in the previous request. If this parameter is specified the response includes only records beyond the marker, up to MaxRecords. Optional.

    • :max_records <~Integer> - The maximum number of records to include in the response. If more records exist, a pagination token is included in the response. Optional.

    • :vpc <~Boolean> - Filter to show only the available VPC or non-VPC offerings. Optional.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fog/aws/requests/rds/describe_orderable_db_instance_options.rb', line 21

def describe_orderable_db_instance_options(engine=nil, opts={})
  params = {}
  params['Engine'] = engine if engine
  params['DBInstanceClass'] = opts[:db_instance_class] if opts[:db_instance_class]
  params['EngineVersion'] = opts[:engine_version] if opts[:engine_version]
  params['LicenseModel'] = opts[:license_model] if opts[:license_model]
  params['Marker'] = opts[:marker] if opts[:marker]
  params['MaxRecords'] = opts[:max_records] if opts[:max_records]
  params['Vpc'] = opts[:vpc] if opts[:vpc]

  request({
    'Action'  => 'DescribeOrderableDBInstanceOptions',
    :parser   => Fog::Parsers::AWS::RDS::DescribeOrderableDBInstanceOptions.new
  }.merge(params))
end

#download_db_logfile_portion(identifier = nil, filename = nil, opts = {}) ⇒ Object

Retrieve a portion of a log file of a db instance docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DownloadDBLogFilePortion.html

Parameters

  • DBInstanceIdentifier <~String> - ID of instance to retrieve information for. Required.

  • LogFileName <~String> - The name of the log file to be downloaded. Required.

  • Options <~Hash> - Hash of options. Optional. The following keys are used:

    • :marker <~String> - The pagination token provided in the previous request. If this parameter is specified the response includes only records beyond the marker, up to MaxRecords. Optional.

    • :max_records <~Integer> - The maximum number of records to include in the response. If more records exist, a pagination token is included in the response. Optional.

    • :number_of_lines <~Integer> - The number of lines to download. Optional.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/requests/rds/download_db_logfile_portion.rb', line 19

def download_db_logfile_portion(identifier=nil, filename=nil, opts={})
  params = {}
  params['DBInstanceIdentifier'] = identifier if identifier
  params['LogFileName'] = filename if filename
  params['Marker'] = opts[:marker] if opts[:marker]
  params['MaxRecords'] = opts[:max_records] if opts[:max_records]
  params['NumberOfLines'] = opts[:number_of_lines] if opts[:number_of_lines]

  request({
    'Action'  => 'DownloadDBLogFilePortion',
    :parser   => Fog::Parsers::AWS::RDS::DownloadDBLogFilePortion.new
  }.merge(params))
end

#list_tags_for_resource(rds_id) ⇒ Object

returns a Hash of tags for a database instance docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_ListTagsForResource.html

Parameters

  • rds_id <~String> - name of the RDS instance whose tags are to be retrieved

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



15
16
17
18
19
20
21
22
23
# File 'lib/fog/aws/requests/rds/list_tags_for_resource.rb', line 15

def list_tags_for_resource(rds_id)
  resource_name = "arn:aws:rds:#{@region}:#{owner_id}:db:#{rds_id}"
  %w[us-gov-west-1 us-gov-east-1].include?(@region) ? resource_name.insert(7, '-us-gov') : resource_name
  request(
    'Action' => 'ListTagsForResource',
    'ResourceName' => resource_name,
    :parser => Fog::Parsers::AWS::RDS::TagListParser.new
  )
end

#modify_db_instance(db_name, apply_immediately, options = {}) ⇒ Object

modifies a database instance docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_ModifyDBInstance.html

Parameters

  • DBInstanceIdentifier <~String> - name of the db instance to modify

  • ApplyImmediately <~Boolean> - whether to apply the changes immediately or wait for the next maintenance window

  • AllocatedStorage <~Integer> Storage space, in GB

  • AllowMajorVersionUpgrade <~Boolean> Must be set to true if EngineVersion specifies a different major version

  • AutoMinorVersionUpgrade <~Boolean> Indicates that minor version upgrades will be applied automatically to the DB Instance during the maintenance window

  • BackupRetentionPeriod <~Integer> 0-8 The number of days to retain automated backups.

  • DBInstanceClass <~String> The new compute and memory capacity of the DB Instanc

  • 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

  • EngineVersion <~String> The version number of the database engine to upgrade to.

  • Iops <~Integer> IOPS rate

  • MasterUserPassword <~String> The new password for the DB Instance master user

  • MultiAZ <~Boolean> Specifies if the DB Instance is a Multi-AZ deployment

  • PreferredBackupWindow <~String> The daily time range during which automated backups are created if automated backups are enabled

  • PreferredMaintenanceWindow <~String> The weekly time range (in UTC) during which system maintenance can occur, which may result in an outage

  • VpcSecurityGroups <~Array> A list of VPC Security Group IDs to authorize on this DB instance

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fog/aws/requests/rds/modify_db_instance.rb', line 30

def modify_db_instance(db_name, apply_immediately, options={})
  if security_groups = options.delete('DBSecurityGroups')
    options.merge!(Fog::AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
  end

  if vpc_security_groups = options.delete('VpcSecurityGroups')
    options.merge!(Fog::AWS.indexed_param('VpcSecurityGroupIds.member.%d', [*vpc_security_groups]))
  end

  request({
    'Action'               => 'ModifyDBInstance',
    'DBInstanceIdentifier' => db_name,
    'ApplyImmediately'     => apply_immediately,
    :parser                => Fog::Parsers::AWS::RDS::ModifyDBInstance.new
  }.merge(options))
end

#modify_db_parameter_group(group_name, parameters) ⇒ Object

modifies a database parameter group docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_ModifyDBParameterGroup.html

Parameters

  • DBParameterGroupName <~String> - name of the parameter group

  • Parameters<~Array> - Array of up to 20 Hashes describing parameters to set

    • ‘ParameterName’<~String> - parameter name.

    • ‘ParameterValue’<~String> - new parameter value

    • ‘ApplyMethod’<~String> - immediate | pending-reboot whether to set the parameter immediately or not (may require an instance restart)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/aws/requests/rds/modify_db_parameter_group.rb', line 19

def modify_db_parameter_group(group_name, parameters)
  parameter_names = []
  parameter_values = []
  parameter_apply_methods = []

  parameters.each do |parameter|
    parameter_names.push(parameter['ParameterName'])
    parameter_values.push(parameter['ParameterValue'])
    parameter_apply_methods.push(parameter['ApplyMethod'])
  end
  params = {}
  params.merge!(Fog::AWS.indexed_param('Parameters.member.%d.ParameterName', parameter_names))
  params.merge!(Fog::AWS.indexed_param('Parameters.member.%d.ParameterValue', parameter_values))
  params.merge!(Fog::AWS.indexed_param('Parameters.member.%d.ApplyMethod', parameter_apply_methods))

  request({
    'Action'  => 'ModifyDBParameterGroup',
    'DBParameterGroupName' => group_name,

    :parser   => Fog::Parsers::AWS::RDS::ModifyDbParameterGroup.new
  }.merge(params))
end

#modify_db_snapshot_attribute(db_snapshot_identifier, attributes) ⇒ Object

Modify db snapshot attributes

Parameters

  • db_snapshot_identifier<~String> - Id of snapshot to modify

  • attributes<~Hash>:

    • ‘Add.MemberId’<~Array> - One or more account ids to grant rds create permission to

    • ‘Remove.MemberId’<~Array> - One or more account ids to revoke rds create permission from

Amazon API Reference



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/rds/modify_db_snapshot_attribute.rb', line 17

def modify_db_snapshot_attribute(db_snapshot_identifier, attributes)
  params = {}
  params.merge!(Fog::AWS.indexed_param('ValuesToAdd.member.%d', attributes['Add.MemberId'] || []))
  params.merge!(Fog::AWS.indexed_param('ValuesToRemove.member.%d', attributes['Remove.MemberId'] || []))
  request({
    'Action'        => 'ModifyDBSnapshotAttribute',
    'DBSnapshotIdentifier'    => db_snapshot_identifier,
    :idempotent     => true,
    'AttributeName' => "restore",
    :parser         => Fog::Parsers::AWS::RDS::ModifyDbSnapshotAttribute.new
  }.merge!(params))
end

#modify_db_subnet_group(name, subnet_ids, description = nil) ⇒ Object

Creates a db subnet group docs.aws.amazon.com/AmazonRDS/2012-01-15/APIReference/API_ModifyDBSubnetGroup.html

Parameters

  • DBSubnetGroupName <~String> - The name for the DB Subnet Group. This value is stored as a lowercase string. Must contain no more than 255 alphanumeric characters or hyphens. Must not be “Default”.

  • SubnetIds <~Array> - The EC2 Subnet IDs for the DB Subnet Group.

  • DBSubnetGroupDescription <~String> - The description for the DB Subnet Group

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



16
17
18
19
20
21
22
23
# File 'lib/fog/aws/requests/rds/modify_db_subnet_group.rb', line 16

def modify_db_subnet_group(name, subnet_ids, description = nil)
  params = { 'Action'  => 'ModifyDBSubnetGroup',
    'DBSubnetGroupName' => name,
    'DBSubnetGroupDescription' => description,
    :parser   => Fog::Parsers::AWS::RDS::ModifyDBSubnetGroup.new }
  params.merge!(Fog::AWS.indexed_param("SubnetIds.member", Array(subnet_ids)))
  request(params)
end

#owner_idObject



231
232
233
# File 'lib/fog/aws/rds.rb', line 231

def owner_id
  @owner_id ||= security_groups.get('default').owner_id
end

#promote_read_replica(identifier, backup_retention_period = nil, preferred_backup_window = nil) ⇒ Object

promote a read replica to a writable RDS instance docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_PromoteReadReplica.html

Parameters

  • DBInstanceIdentifier <~String> - The DB Instance identifier for the DB Instance to be deleted.

  • BackupRetentionPeriod <~Integer> - The number of days to retain automated backups. Range: 0-8.

    Setting this parameter to a positive number enables backups.
    Setting this parameter to 0 disables automated backups.
    
  • PreferredBackupWindow <~String> - The daily time range during which automated backups are created if

    automated backups are enabled, using the BackupRetentionPeriod parameter.
    Default: A 30-minute window selected at random from an 8-hour block of time per region.
    

See the Amazon RDS User Guide for the time blocks for each region from which the default backup windows are assigned.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/aws/requests/rds/promote_read_replica.rb', line 23

def promote_read_replica(identifier, backup_retention_period = nil, preferred_backup_window = nil)
  params = {}
  params['BackupRetentionPeriod'] = backup_retention_period if backup_retention_period
  params['PreferredBackupWindow'] = preferred_backup_window if preferred_backup_window
  request({
    'Action'               => 'PromoteReadReplica',
    'DBInstanceIdentifier' => identifier,
    :parser                => Fog::Parsers::AWS::RDS::PromoteReadReplica.new
  }.merge(params))
end

#reboot_db_instance(instance_identifier) ⇒ Object

reboots a database instance docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_RebootDBInstance.html

Parameters

  • DBInstanceIdentifier <~String> - name of the db instance to reboot

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



14
15
16
17
18
19
20
# File 'lib/fog/aws/requests/rds/reboot_db_instance.rb', line 14

def reboot_db_instance(instance_identifier)
  request({
    'Action'  => 'RebootDBInstance',
    'DBInstanceIdentifier' => instance_identifier,
    :parser   => Fog::Parsers::AWS::RDS::RebootDBInstance.new,
  })
end

#reloadObject



235
236
237
# File 'lib/fog/aws/rds.rb', line 235

def reload
  @connection.reset
end

#remove_tags_from_resource(rds_id, keys) ⇒ Object

removes tags from a database instance docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_RemoveTagsFromResource.html

Parameters

  • rds_id <~String> - name of the RDS instance whose tags are to be retrieved

  • keys <~Array> A list of String keys for the tags to remove

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



13
14
15
16
17
18
19
20
21
# File 'lib/fog/aws/requests/rds/remove_tags_from_resource.rb', line 13

def remove_tags_from_resource(rds_id, keys)
  resource_name = "arn:aws:rds:#{@region}:#{owner_id}:db:#{rds_id}"
  %w[us-gov-west-1 us-gov-east-1].include?(@region) ? resource_name.insert(7, '-us-gov') : resource_name
  request(
    { 'Action' => 'RemoveTagsFromResource',
      'ResourceName' => resource_name,
      :parser => Fog::Parsers::AWS::RDS::Base.new }.merge(Fog::AWS.indexed_param('TagKeys.member.%d', keys))
  )
end

#restore_db_instance_from_db_snapshot(snapshot_id, db_name, opts = {}) ⇒ Object

Restores a DB Instance from a DB Snapshot docs.amazonwebservices.com/AmazonRDS/latest/APIReference/index.html?API_RestoreDBInstanceFromDBSnapshot.html

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



12
13
14
15
16
17
18
19
# File 'lib/fog/aws/requests/rds/restore_db_instance_from_db_snapshot.rb', line 12

def restore_db_instance_from_db_snapshot(snapshot_id, db_name, opts={})
  request({
    'Action'  => 'RestoreDBInstanceFromDBSnapshot',
    'DBSnapshotIdentifier' => snapshot_id,
    'DBInstanceIdentifier' => db_name,
    :parser   => Fog::Parsers::AWS::RDS::RestoreDBInstanceFromDBSnapshot.new,
  }.merge(opts))
end

#restore_db_instance_to_point_in_time(source_db_name, target_db_name, opts = {}) ⇒ Object

Restores a DB Instance to a point in time docs.amazonwebservices.com/AmazonRDS/latest/APIReference/index.html?API_RestoreDBInstanceToPointInTime.html

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



12
13
14
15
16
17
18
19
# File 'lib/fog/aws/requests/rds/restore_db_instance_to_point_in_time.rb', line 12

def restore_db_instance_to_point_in_time(source_db_name, target_db_name, opts={})
  request({
    'Action'  => 'RestoreDBInstanceToPointInTime',
    'SourceDBInstanceIdentifier' => source_db_name,
    'TargetDBInstanceIdentifier' => target_db_name,
    :parser   => Fog::Parsers::AWS::RDS::RestoreDBInstanceToPointInTime.new,
  }.merge(opts))
end

#revoke_db_security_group_ingress(name, opts = {}) ⇒ Object

revokes a db security group ingress docs.amazonwebservices.com/AmazonRDS/latest/APIReference/index.html?API_RevokeDBSecurityGroupIngress.html

Parameters

  • CIDRIP <~String> - The IP range to revoke

  • DBSecurityGroupName <~String> - The name for the DB Security Group.

  • EC2SecurityGroupName <~String> - Name of the EC2 Security Group to revoke.

  • EC2SecurityGroupOwnerId <~String> - AWS Account Number of the owner of the security group specified in the EC2SecurityGroupName parameter. The AWS Access Key ID is not an acceptable value.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb', line 17

def revoke_db_security_group_ingress(name, opts={})
  unless opts.key?('CIDRIP') || ((opts.key?('EC2SecurityGroupName') || opts.key?('EC2SecurityGroupId')) && opts.key?('EC2SecurityGroupOwnerId'))
    raise ArgumentError, 'Must specify CIDRIP, or one of EC2SecurityGroupName or EC2SecurityGroupId, and EC2SecurityGroupOwnerId'
  end

  request({
    'Action'  => 'RevokeDBSecurityGroupIngress',
    :parser   => Fog::Parsers::AWS::RDS::RevokeDBSecurityGroupIngress.new,
    'DBSecurityGroupName' => name
  }.merge(opts))
end