Sha256: fb67cd9d35fb0dfdb9696acf718a88cada2984f0058c630c808773539389f517

Contents?: true

Size: 1.38 KB

Versions: 32

Compression:

Stored size: 1.38 KB

Contents

class BuildCloud::CacheCluster

    include ::BuildCloud::Component

    @@objects = []

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

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

        @log.debug( options.inspect )

        required_options(:id, :node_type, :num_nodes, :auto_minor_version_upgrade, 
            :engine, :cache_subnet_group_name)
        require_one_of(:vpc_security_groups, :vpc_security_group_names)

    end

    def create

        return if exists?

        @log.info( "Creating Elasticache Cluster #{@options[:id]}" )

        options = @options.dup

        unless options[:vpc_security_groups]

            options[:vpc_security_groups] = []

            options[:vpc_security_group_names].each do |sg|
                options[:vpc_security_groups] << BuildCloud::SecurityGroup. get_id_by_name( sg )
            end

            options.delete(:vpc_security_group_names)

        end

        cluster = @elasticache.clusters.new( options )
        cluster.save

        @log.debug( cluster.inspect )

    end

    def read
        @elasticache.clusters.select { |c| c.id == @options[:id] }.first
    end

    alias_method :fog_object, :read

    def delete

        return unless exists?

        @log.info( "Deleting Elasticache cluster #{@options[:id]}" )

        fog_object.destroy

    end

end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
build-cloud-1.1.7 lib/build-cloud/cachecluster.rb
build-cloud-1.1.6 lib/build-cloud/cachecluster.rb
build-cloud-1.1.5 lib/build-cloud/cachecluster.rb
build-cloud-1.1.4 lib/build-cloud/cachecluster.rb
build-cloud-1.1.3 lib/build-cloud/cachecluster.rb
build-cloud-1.1.2 lib/build-cloud/cachecluster.rb
build-cloud-1.0.1 lib/build-cloud/cachecluster.rb
build-cloud-1.1.1 lib/build-cloud/cachecluster.rb
build-cloud-1.0.0 lib/build-cloud/cachecluster.rb
build-cloud-0.0.24 lib/build-cloud/cachecluster.rb
build-cloud-0.0.23 lib/build-cloud/cachecluster.rb
build-cloud-0.0.22 lib/build-cloud/cachecluster.rb
build-cloud-0.0.21 lib/build-cloud/cachecluster.rb
build-cloud-0.0.20 lib/build-cloud/cachecluster.rb
build-cloud-0.0.19 lib/build-cloud/cachecluster.rb
build-cloud-0.0.18 lib/build-cloud/cachecluster.rb
build-cloud-0.0.17 lib/build-cloud/cachecluster.rb
build-cloud-0.0.16 lib/build-cloud/cachecluster.rb
build-cloud-0.0.15 lib/build-cloud/cachecluster.rb
build-cloud-0.0.14 lib/build-cloud/cachecluster.rb