Class: BuildCloud::CacheParameterGroup

Inherits:
Object
  • Object
show all
Includes:
Component
Defined in:
lib/build-cloud/cacheparametergroup.rb

Constant Summary collapse

@@objects =
[]

Instance Method Summary collapse

Methods included from Component

included

Constructor Details

#initialize(fog_interfaces, log, options = {}) ⇒ CacheParameterGroup

Returns a new instance of CacheParameterGroup.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/build-cloud/cacheparametergroup.rb', line 8

def initialize ( fog_interfaces, log, options = {} )

    @elasticache  = fog_interfaces[:elasticache]
    @log          = log
    @options      = options

    @log.debug( options.inspect )

    required_options(:family, :description, :id, :params)

end

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/build-cloud/cacheparametergroup.rb', line 20

def create
    
    return if exists?

    @log.info( "Creating Cache Parameter Group #{@options[:id]}" )

    options = @options.dup

    param_group = @elasticache.create_cache_parameter_group(options[:id], options[:description], options[:family])

    @log.debug( param_group.inspect )

    params = @elasticache.modify_cache_parameter_group options[:id], options[:params]

    @log.debug( params.inspect )

end

#deleteObject



44
45
46
47
48
49
50
51
52
53
# File 'lib/build-cloud/cacheparametergroup.rb', line 44

def delete

    return unless exists?

    @log.info( "Deleting Cache Parameter Group #{@options[:id]}" )

    puts fog_object.inspect
    fog_object.destroy

end

#readObject Also known as: fog_object



38
39
40
# File 'lib/build-cloud/cacheparametergroup.rb', line 38

def read
    @elasticache.parameter_groups.select { |g| g.id == "#{@options[:id]}".downcase }.first
end