Sha256: 3e0cf9674178389a2dface7ff19c0d7f442c92419b5ed828b9e87056d288ca02

Contents?: true

Size: 1.95 KB

Versions: 101

Compression:

Stored size: 1.95 KB

Contents

module Fog
  module Compute
    class AWS

      class Real

        require 'fog/aws/parsers/compute/monitor_unmonitor_instances'

        # UnMonitor specified instance
        # http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-UnmonitorInstances.html
        #
        # ==== Parameters
        # * instance_ids<~Array> - Arrays of instances Ids to monitor
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'requestId'<~String> - Id of request
        #     * 'instancesSet': http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-MonitorInstancesResponseSetItemType.html
        #
        # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-UnmonitorInstances.html]
        def unmonitor_instances(instance_ids)
          params = Fog::AWS.indexed_param('InstanceId', instance_ids)
          request({
                          'Action' => 'UnmonitorInstances',
                          :idempotent => true,
                          :parser => Fog::Parsers::Compute::AWS::MonitorUnmonitorInstances.new
                  }.merge!(params))
        end

      end

      class Mock

        def unmonitor_instances(instance_ids)
          response        = Excon::Response.new
          response.status = 200
          [*instance_ids].each do |instance_id|
            if instance = self.data[:instances][instance_id]
              instance['monitoring']['state'] = 'enabled'
            else
              raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_ids}' does not exist")
            end
          end
          instances_set = [*instance_ids].inject([]) { |memo, id| memo << {'instanceId' => id, 'monitoring' => 'disabled'} }
          response.body = {'requestId' => 'some_request_id', 'instancesSet' => instances_set}
          response
        end
        
      end

    end

  end
end

Version data entries

101 entries across 101 versions & 17 rubygems

Version Path
fog-test-again-1.6.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-test-me-1.10.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-parser-fix-1.6.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-1.10.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-1.9.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/aws/requests/compute/unmonitor_instances.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-sgonyea-1.8.1 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-1.8.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-1.7.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-1.6.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-1.5.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-1.4.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/unmonitor_instances.rb
michiels-fog-1.3.1 lib/fog/aws/requests/compute/unmonitor_instances.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/requests/compute/unmonitor_instances.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/unmonitor_instances.rb