Sha256: f0ee20ecf4e1be5f99d3d51d3f7efe3bffd408e7ea747bfd88eb62e0af70b8fd

Contents?: true

Size: 1.73 KB

Versions: 98

Compression:

Stored size: 1.73 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.reduce({}) 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

98 entries across 96 versions & 6 rubygems

Version Path
fog-aws-0.8.1 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.8.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-aws-0.7.5/lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.7.6 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.7.5 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.7.4 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.7.3 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.7.2 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.6.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.5.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.4.1 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.4.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.3.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.2.2 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.2.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.1.2 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.1.1 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.1.0 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb
fog-aws-0.0.8 lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb