Sha256: a8667c51cd122927cbf00ca20fd68ba482c0d98b6b2d82e2a1e976f843a5737f

Contents?: true

Size: 1.74 KB

Versions: 77

Compression:

Stored size: 1.74 KB

Contents

module Fog
  module AWS
    class Elasticache
      class Real

        require 'fog/aws/parsers/elasticache/single_cache_cluster'

        # Reboots some or all of an existing cache cluster's nodes
        # Returns a cache cluster description
        #
        # === Required Parameters
        # * id <~String> - The ID of the existing cluster to be rebooted
        # === Optional Parameters
        # * nodes_to_reboot <~Array> - Array of node IDs to reboot
        # === Returns
        # * response <~Excon::Response>:
        #   * body <~Hash>
        def reboot_cache_cluster(id, nodes_to_reboot)
          # Construct CacheNodeIdsToReboot parameters in the format:
          #   CacheNodeIdsToReboot.member.N => "node_id"
          node_ids = nodes_to_reboot || []
          node_id_params = node_ids.inject({}) do |node_hash, node_id|
            index = node_ids.index(node_id) + 1
            node_hash["CacheNodeIdsToReboot.member.#{index}"] = node_id
            node_hash
          end
          # Merge the CacheNodeIdsToReboot parameters with the normal options
          request(node_id_params.merge(
            'Action'          => 'RebootCacheCluster',
            'CacheClusterId'  => id,
            :parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new
          ))
        end

      end

      class Mock
        def reboot_cache_cluster(id, nodes_to_reboot)
          response        = Excon::Response.new
          response.body   = {
            'CacheCluster' => self.data[:clusters][id].merge({
              'CacheClusterStatus' => 'rebooting cache cluster nodes'
            }),
            'ResponseMetadata'  => { 'RequestId' => Fog::AWS::Mock.request_id }
          }
          response
        end
      end

    end
  end
end

Version data entries

77 entries across 77 versions & 11 rubygems

Version Path
fog-1.22.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-1.21.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-1.20.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-1.19.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb