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-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-1.20.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-1.19.0 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/aws/requests/compute/unmonitor_instances.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/aws/requests/compute/unmonitor_instances.rb