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/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/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/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/delete_db_parameter_group.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/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_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/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.



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/fog/aws/rds.rb', line 158

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] || '2013-05-15'

  setup_credentials(options)
end

Instance Attribute Details

#regionObject (readonly)

Returns the value of attribute region.



137
138
139
# File 'lib/fog/aws/rds.rb', line 137

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
# 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]}
  request({
      'Action'        => 'AddTagsToResource',
      'ResourceName'  => "arn:aws:rds:#{@region}:#{owner_id}:db:#{rds_id}",
      :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?('EC2SecurityGroupOwnerId'))
    raise ArgumentError, 'Must specify CIDRIP, or both EC2SecurityGroupName and EC2SecurityGroupOwnerId'
  end

  request({
    'Action'  => 'AuthorizeDBSecurityGroupIngress',
    :parser   => Fog::Parsers::AWS::RDS::AuthorizeDBSecurityGroupIngress.new,
    'DBSecurityGroupName' => name
  }.merge(opts))
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

  • PubliclyAcccesible (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

Returns:

  • (Excon::Response)

    :

    • body [Hash]:

See Also:



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

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

#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

#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 retrive (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_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 load db instances docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DescribeDBInstances.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>:



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

def list_tags_for_resource(rds_id)
  request(
    'Action'        => 'ListTagsForResource',
    'ResourceName'  => "arn:aws:rds:#{@region}:#{owner_id}:db:#{rds_id}",
    :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 paremeter 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

#owner_idObject



176
177
178
# File 'lib/fog/aws/rds.rb', line 176

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



180
181
182
# File 'lib/fog/aws/rds.rb', line 180

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
# File 'lib/fog/aws/requests/rds/remove_tags_from_resource.rb', line 13

def remove_tags_from_resource(rds_id, keys)
  request(
    { 'Action'        => 'RemoveTagsFromResource',
      'ResourceName'  => "arn:aws:rds:#{@region}:#{owner_id}:db:#{rds_id}",
      :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?('EC2SecurityGroupOwnerId'))
    raise ArgumentError, 'Must specify CIDRIP, or both EC2SecurityGroupName and EC2SecurityGroupOwnerId'
  end

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