Class: RDSTUNE::RdsTune

Inherits:
MrTuner
  • Object
show all
Defined in:
lib/rdstune.rb

Instance Method Summary collapse

Constructor Details

#initialize(instance_type: nil, type: nil, memory: nil, options: {}, aws_credentials: {}, rds_client: nil) ⇒ RdsTune

Returns a new instance of RdsTune.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rdstune.rb', line 9

def initialize(instance_type: nil, type: nil, memory: nil, options: {}, aws_credentials: {}, rds_client: nil)
  if rds_client
    @rds   = rds_client
  else
    @rds   = Aws::RDS::Client.new(aws_credentials)
  end

  if instance_type then
    @ec2info = Ec2Info.new(instance_type)
    @memory  = @ec2info.get_memory
  else
    @memory  = memory
  end
  @type    = type
  @options = options
  super(@type, @memory, @options)
end

Instance Method Details

#create_parameter_group(name: nil, family: nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rdstune.rb', line 27

def create_parameter_group(name: nil, family: nil)
  abort("Please Specify a Parameter Group Name: #{name} or Family: #{family}") unless name && family
  group_name   = name
  group_family = family
  unless find_parameter_group(group_name)
    description = "Created by RdsTune - #{@type} - #{@memory} - #{Time.now.to_s}"
    @rds.create_db_parameter_group({
      :db_parameter_group_name   => group_name,
      :db_parameter_group_family => group_family,
      :description               => description
    })
  end
  update_parameter_group(group_name)
end