<commit_before>module Fog
  module AWS
    class Compute
      class Real
        require 'fog/aws/parsers/compute/start_stop_instances'

        # Stop specified instance
        #
        # ==== Parameters
        # * instance_id<~Array> - Id of instance to start
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'requestId'<~String> - Id of request
        #     * TODO: fill in the blanks
        #
        # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html]
        def stop_instances(instance_id, options = {})
          params = Fog::AWS.indexed_param('InstanceId', instance_id)
          params.merge!('Force' => 'true') if options['force']
          if options['hibernate']
            params.merge!('Hibernate' => 'true')
            params.merge!('Force' => 'false')
          end
          request({
            'Action'    => 'StopInstances',
            :idempotent => true,
            :parser     => Fog::Parsers::AWS::Compute::StartStopInstances.new
          }.merge!(params))
        end
      end

      class Mock
        def stop_instances(instance_id, force = false)
          instance_ids = Array(instance_id)<commit_msg>add backwards compatibility<commit_after>module Fog
  module AWS
    class Compute
      class Real
        require 'fog/aws/parsers/compute/start_stop_instances'

        # Stop specified instance
        #
        # ==== Parameters
        # * instance_id<~Array> - Id of instance to start
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'requestId'<~String> - Id of request
        #     * TODO: fill in the blanks
        #
        # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html]
        def stop_instances(instance_id, options = {})
          params = Fog::AWS.indexed_param('InstanceId', instance_id)
          unless options.is_a?(Hash)
            Fog::Logger.warning("stop_instances with #{options.class} param is deprecated, use stop_instances('force' => boolean) instead [light_black](#{caller.first})[/]")
            options = {'force' => options}
          end
          params.merge!('Force' => 'true') if options['force']
          if options['hibernate']
            params.merge!('Hibernate' => 'true')
            params.merge!('Force' => 'false')
          end
          request({
            'Action'    => 'StopInstances',
            :idempotent => true,
            :parser     => Fog::Parsers::AWS::Compute::StartStopInstances.new
          }.merge!(params))
        end
      end

      class Mock
        def stop_instances(instance_id, force = false)
          instance_ids = Array(instance_id)
{'fraction_non_alphanumeric': 0.1276297335203366, 'fraction_numerical': 0.0007012622720897616, 'mean_word_length': 2.094360086767896, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4369804', 'n_tokens_mistral': 820, 'n_tokens_neox': 801, 'n_words': 158}