Class: BuildCloud::CacheSubnetGroup
- Inherits:
-
Object
- Object
- BuildCloud::CacheSubnetGroup
- Includes:
- Component
- Defined in:
- lib/build-cloud/cachesubnetgroup.rb
Constant Summary collapse
- @@objects =
[]
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
-
#initialize(fog_interfaces, log, options = {}) ⇒ CacheSubnetGroup
constructor
A new instance of CacheSubnetGroup.
- #read ⇒ Object (also: #fog_object)
Methods included from Component
Constructor Details
#initialize(fog_interfaces, log, options = {}) ⇒ CacheSubnetGroup
Returns a new instance of CacheSubnetGroup.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/build-cloud/cachesubnetgroup.rb', line 8 def initialize ( fog_interfaces, log, = {} ) @elasticache = fog_interfaces[:elasticache] @log = log @options = @log.debug( .inspect ) (:name) require_one_of(:subnet_ids, :subnet_names) end |
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/build-cloud/cachesubnetgroup.rb', line 21 def create return if exists? @log.info( "Creating Cache Subnet Group #{@options[:id]}" ) = @options.dup unless [:subnet_ids] [:subnet_ids] = [] [:subnet_names].each do |sn| [:subnet_ids] << BuildCloud::Subnet.get_id_by_name( sn ) end .delete(:subnet_names) end group = @elasticache.create_cache_subnet_group( [:name], [:subnet_ids] ) @log.debug( group.inspect ) end |
#delete ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/build-cloud/cachesubnetgroup.rb', line 53 def delete return unless exists? @log.info( "Deleting Cache Subnet Group #{@options[:name]}" ) fog_object.destroy end |
#read ⇒ Object Also known as: fog_object
47 48 49 |
# File 'lib/build-cloud/cachesubnetgroup.rb', line 47 def read @elasticache.subnet_groups.select { |g| g.id == @options[:name] }.first end |