Sha256: c472dc1cf8fa2510349ab5f8a074acded02472b1222543a0ca194d1f99795613

Contents?: true

Size: 1.2 KB

Versions: 95

Compression:

Stored size: 1.2 KB

Contents

module Fog
  module Compute
    class VcloudDirector
      class Real
        extend Fog::Deprecation
        deprecate :post_task_cancel, :post_cancel_task

        # Cancel a task.
        #
        # @param [String] id Object identifier of the task.
        # @return [Excon::Response]
        #
        # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CancelTask.html
        # @since vCloud API version 1.5
        def post_cancel_task(id)
          request(
            :expects => 204,
            :method  => 'POST',
            :path    => "task/#{id}/action/cancel"
          )
        end
      end

      class Mock
        def post_cancel_task(id)
          unless task = data[:tasks][id]
            raise Fog::Compute::VcloudDirector::Forbidden.new(
              'No access to entity "com.vmware.vcloud.entity.task:%s"' % id
            )
          end

          # @note Tasks don't actually get cancelled (confirmed VCloud Director
          #   bug) so we'll emulate that. Set the flag and we're done!
          task[:cancel_requested] = true

          Excon::Response.new(
            :status => 204
          )
        end
      end
    end
  end
end

Version data entries

95 entries across 93 versions & 8 rubygems

Version Path
fog-maestrodev-1.18.0.20131127194823 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-1.18.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-1.17.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb