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-2.3.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-ifeel-2.2.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-2.2.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-2.1.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-1.42.1 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-vcloud-director-0.2.2 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-vcloud-director-0.2.1 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-vcloud-director-0.2.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-vcloud-director-0.1.10 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-vcloud-director-0.1.9 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-2.0.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-1.42.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-1.41.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-1.40.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-1.39.0 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-vcloud-director-0.1.8 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb
fog-vcloud-director-0.1.7 lib/fog/vcloud_director/requests/compute/post_cancel_task.rb