{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SWF.RecordActivityTaskHeartbeat
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Used by activity workers to report to the service that the ActivityTask
-- represented by the specified @taskToken@ is still making progress. The
-- worker can also specify details of the progress, for example percent
-- complete, using the @details@ parameter. This action can also be used by
-- the worker as a mechanism to check if cancellation is being requested
-- for the activity task. If a cancellation is being attempted for the
-- specified task, then the boolean @cancelRequested@ flag returned by the
-- service is set to @true@.
--
-- This action resets the @taskHeartbeatTimeout@ clock. The
-- @taskHeartbeatTimeout@ is specified in RegisterActivityType.
--
-- This action doesn\'t in itself create an event in the workflow execution
-- history. However, if the task times out, the workflow execution history
-- contains a @ActivityTaskTimedOut@ event that contains the information
-- from the last heartbeat generated by the activity worker.
--
-- The @taskStartToCloseTimeout@ of an activity type is the maximum
-- duration of an activity task, regardless of the number of
-- RecordActivityTaskHeartbeat requests received. The
-- @taskStartToCloseTimeout@ is also specified in RegisterActivityType.
--
-- This operation is only useful for long-lived activities to report
-- liveliness of the task and to determine if a cancellation is being
-- attempted.
--
-- If the @cancelRequested@ flag returns @true@, a cancellation is being
-- attempted. If the worker can cancel the activity, it should respond with
-- RespondActivityTaskCanceled. Otherwise, it should ignore the
-- cancellation request.
--
-- __Access Control__
--
-- You can use IAM policies to control this action\'s access to Amazon SWF
-- resources as follows:
--
-- -   Use a @Resource@ element with the domain name to limit the action to
--     only specified domains.
--
-- -   Use an @Action@ element to allow or deny permission to call this
--     action.
--
-- -   You cannot use an IAM policy to constrain this action\'s parameters.
--
-- If the caller doesn\'t have sufficient permissions to invoke the action,
-- or the parameter values fall outside the specified constraints, the
-- action fails. The associated event attribute\'s @cause@ parameter is set
-- to @OPERATION_NOT_PERMITTED@. For details and example IAM policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
module Amazonka.SWF.RecordActivityTaskHeartbeat
  ( -- * Creating a Request
    RecordActivityTaskHeartbeat (..),
    newRecordActivityTaskHeartbeat,

    -- * Request Lenses
    recordActivityTaskHeartbeat_details,
    recordActivityTaskHeartbeat_taskToken,

    -- * Destructuring the Response
    RecordActivityTaskHeartbeatResponse (..),
    newRecordActivityTaskHeartbeatResponse,

    -- * Response Lenses
    recordActivityTaskHeartbeatResponse_httpStatus,
    recordActivityTaskHeartbeatResponse_cancelRequested,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SWF.Types

-- | /See:/ 'newRecordActivityTaskHeartbeat' smart constructor.
data RecordActivityTaskHeartbeat = RecordActivityTaskHeartbeat'
  { -- | If specified, contains details about the progress of the task.
    RecordActivityTaskHeartbeat -> Maybe Text
details :: Prelude.Maybe Prelude.Text,
    -- | The @taskToken@ of the ActivityTask.
    --
    -- @taskToken@ is generated by the service and should be treated as an
    -- opaque value. If the task is passed to another process, its @taskToken@
    -- must also be passed. This enables it to provide its progress and respond
    -- with results.
    RecordActivityTaskHeartbeat -> Text
taskToken :: Prelude.Text
  }
  deriving (RecordActivityTaskHeartbeat -> RecordActivityTaskHeartbeat -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecordActivityTaskHeartbeat -> RecordActivityTaskHeartbeat -> Bool
$c/= :: RecordActivityTaskHeartbeat -> RecordActivityTaskHeartbeat -> Bool
== :: RecordActivityTaskHeartbeat -> RecordActivityTaskHeartbeat -> Bool
$c== :: RecordActivityTaskHeartbeat -> RecordActivityTaskHeartbeat -> Bool
Prelude.Eq, ReadPrec [RecordActivityTaskHeartbeat]
ReadPrec RecordActivityTaskHeartbeat
Int -> ReadS RecordActivityTaskHeartbeat
ReadS [RecordActivityTaskHeartbeat]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecordActivityTaskHeartbeat]
$creadListPrec :: ReadPrec [RecordActivityTaskHeartbeat]
readPrec :: ReadPrec RecordActivityTaskHeartbeat
$creadPrec :: ReadPrec RecordActivityTaskHeartbeat
readList :: ReadS [RecordActivityTaskHeartbeat]
$creadList :: ReadS [RecordActivityTaskHeartbeat]
readsPrec :: Int -> ReadS RecordActivityTaskHeartbeat
$creadsPrec :: Int -> ReadS RecordActivityTaskHeartbeat
Prelude.Read, Int -> RecordActivityTaskHeartbeat -> ShowS
[RecordActivityTaskHeartbeat] -> ShowS
RecordActivityTaskHeartbeat -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecordActivityTaskHeartbeat] -> ShowS
$cshowList :: [RecordActivityTaskHeartbeat] -> ShowS
show :: RecordActivityTaskHeartbeat -> String
$cshow :: RecordActivityTaskHeartbeat -> String
showsPrec :: Int -> RecordActivityTaskHeartbeat -> ShowS
$cshowsPrec :: Int -> RecordActivityTaskHeartbeat -> ShowS
Prelude.Show, forall x.
Rep RecordActivityTaskHeartbeat x -> RecordActivityTaskHeartbeat
forall x.
RecordActivityTaskHeartbeat -> Rep RecordActivityTaskHeartbeat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RecordActivityTaskHeartbeat x -> RecordActivityTaskHeartbeat
$cfrom :: forall x.
RecordActivityTaskHeartbeat -> Rep RecordActivityTaskHeartbeat x
Prelude.Generic)

-- |
-- Create a value of 'RecordActivityTaskHeartbeat' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'details', 'recordActivityTaskHeartbeat_details' - If specified, contains details about the progress of the task.
--
-- 'taskToken', 'recordActivityTaskHeartbeat_taskToken' - The @taskToken@ of the ActivityTask.
--
-- @taskToken@ is generated by the service and should be treated as an
-- opaque value. If the task is passed to another process, its @taskToken@
-- must also be passed. This enables it to provide its progress and respond
-- with results.
newRecordActivityTaskHeartbeat ::
  -- | 'taskToken'
  Prelude.Text ->
  RecordActivityTaskHeartbeat
newRecordActivityTaskHeartbeat :: Text -> RecordActivityTaskHeartbeat
newRecordActivityTaskHeartbeat Text
pTaskToken_ =
  RecordActivityTaskHeartbeat'
    { $sel:details:RecordActivityTaskHeartbeat' :: Maybe Text
details =
        forall a. Maybe a
Prelude.Nothing,
      $sel:taskToken:RecordActivityTaskHeartbeat' :: Text
taskToken = Text
pTaskToken_
    }

-- | If specified, contains details about the progress of the task.
recordActivityTaskHeartbeat_details :: Lens.Lens' RecordActivityTaskHeartbeat (Prelude.Maybe Prelude.Text)
recordActivityTaskHeartbeat_details :: Lens' RecordActivityTaskHeartbeat (Maybe Text)
recordActivityTaskHeartbeat_details = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordActivityTaskHeartbeat' {Maybe Text
details :: Maybe Text
$sel:details:RecordActivityTaskHeartbeat' :: RecordActivityTaskHeartbeat -> Maybe Text
details} -> Maybe Text
details) (\s :: RecordActivityTaskHeartbeat
s@RecordActivityTaskHeartbeat' {} Maybe Text
a -> RecordActivityTaskHeartbeat
s {$sel:details:RecordActivityTaskHeartbeat' :: Maybe Text
details = Maybe Text
a} :: RecordActivityTaskHeartbeat)

-- | The @taskToken@ of the ActivityTask.
--
-- @taskToken@ is generated by the service and should be treated as an
-- opaque value. If the task is passed to another process, its @taskToken@
-- must also be passed. This enables it to provide its progress and respond
-- with results.
recordActivityTaskHeartbeat_taskToken :: Lens.Lens' RecordActivityTaskHeartbeat Prelude.Text
recordActivityTaskHeartbeat_taskToken :: Lens' RecordActivityTaskHeartbeat Text
recordActivityTaskHeartbeat_taskToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordActivityTaskHeartbeat' {Text
taskToken :: Text
$sel:taskToken:RecordActivityTaskHeartbeat' :: RecordActivityTaskHeartbeat -> Text
taskToken} -> Text
taskToken) (\s :: RecordActivityTaskHeartbeat
s@RecordActivityTaskHeartbeat' {} Text
a -> RecordActivityTaskHeartbeat
s {$sel:taskToken:RecordActivityTaskHeartbeat' :: Text
taskToken = Text
a} :: RecordActivityTaskHeartbeat)

instance Core.AWSRequest RecordActivityTaskHeartbeat where
  type
    AWSResponse RecordActivityTaskHeartbeat =
      RecordActivityTaskHeartbeatResponse
  request :: (Service -> Service)
-> RecordActivityTaskHeartbeat
-> Request RecordActivityTaskHeartbeat
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy RecordActivityTaskHeartbeat
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RecordActivityTaskHeartbeat)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Bool -> RecordActivityTaskHeartbeatResponse
RecordActivityTaskHeartbeatResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"cancelRequested")
      )

instance Prelude.Hashable RecordActivityTaskHeartbeat where
  hashWithSalt :: Int -> RecordActivityTaskHeartbeat -> Int
hashWithSalt Int
_salt RecordActivityTaskHeartbeat' {Maybe Text
Text
taskToken :: Text
details :: Maybe Text
$sel:taskToken:RecordActivityTaskHeartbeat' :: RecordActivityTaskHeartbeat -> Text
$sel:details:RecordActivityTaskHeartbeat' :: RecordActivityTaskHeartbeat -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
details
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
taskToken

instance Prelude.NFData RecordActivityTaskHeartbeat where
  rnf :: RecordActivityTaskHeartbeat -> ()
rnf RecordActivityTaskHeartbeat' {Maybe Text
Text
taskToken :: Text
details :: Maybe Text
$sel:taskToken:RecordActivityTaskHeartbeat' :: RecordActivityTaskHeartbeat -> Text
$sel:details:RecordActivityTaskHeartbeat' :: RecordActivityTaskHeartbeat -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
details
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
taskToken

instance Data.ToHeaders RecordActivityTaskHeartbeat where
  toHeaders :: RecordActivityTaskHeartbeat -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"SimpleWorkflowService.RecordActivityTaskHeartbeat" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON RecordActivityTaskHeartbeat where
  toJSON :: RecordActivityTaskHeartbeat -> Value
toJSON RecordActivityTaskHeartbeat' {Maybe Text
Text
taskToken :: Text
details :: Maybe Text
$sel:taskToken:RecordActivityTaskHeartbeat' :: RecordActivityTaskHeartbeat -> Text
$sel:details:RecordActivityTaskHeartbeat' :: RecordActivityTaskHeartbeat -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"details" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
details,
            forall a. a -> Maybe a
Prelude.Just (Key
"taskToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
taskToken)
          ]
      )

instance Data.ToPath RecordActivityTaskHeartbeat where
  toPath :: RecordActivityTaskHeartbeat -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery RecordActivityTaskHeartbeat where
  toQuery :: RecordActivityTaskHeartbeat -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | Status information about an activity task.
--
-- /See:/ 'newRecordActivityTaskHeartbeatResponse' smart constructor.
data RecordActivityTaskHeartbeatResponse = RecordActivityTaskHeartbeatResponse'
  { -- | The response's http status code.
    RecordActivityTaskHeartbeatResponse -> Int
httpStatus :: Prelude.Int,
    -- | Set to @true@ if cancellation of the task is requested.
    RecordActivityTaskHeartbeatResponse -> Bool
cancelRequested :: Prelude.Bool
  }
  deriving (RecordActivityTaskHeartbeatResponse
-> RecordActivityTaskHeartbeatResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecordActivityTaskHeartbeatResponse
-> RecordActivityTaskHeartbeatResponse -> Bool
$c/= :: RecordActivityTaskHeartbeatResponse
-> RecordActivityTaskHeartbeatResponse -> Bool
== :: RecordActivityTaskHeartbeatResponse
-> RecordActivityTaskHeartbeatResponse -> Bool
$c== :: RecordActivityTaskHeartbeatResponse
-> RecordActivityTaskHeartbeatResponse -> Bool
Prelude.Eq, ReadPrec [RecordActivityTaskHeartbeatResponse]
ReadPrec RecordActivityTaskHeartbeatResponse
Int -> ReadS RecordActivityTaskHeartbeatResponse
ReadS [RecordActivityTaskHeartbeatResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecordActivityTaskHeartbeatResponse]
$creadListPrec :: ReadPrec [RecordActivityTaskHeartbeatResponse]
readPrec :: ReadPrec RecordActivityTaskHeartbeatResponse
$creadPrec :: ReadPrec RecordActivityTaskHeartbeatResponse
readList :: ReadS [RecordActivityTaskHeartbeatResponse]
$creadList :: ReadS [RecordActivityTaskHeartbeatResponse]
readsPrec :: Int -> ReadS RecordActivityTaskHeartbeatResponse
$creadsPrec :: Int -> ReadS RecordActivityTaskHeartbeatResponse
Prelude.Read, Int -> RecordActivityTaskHeartbeatResponse -> ShowS
[RecordActivityTaskHeartbeatResponse] -> ShowS
RecordActivityTaskHeartbeatResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecordActivityTaskHeartbeatResponse] -> ShowS
$cshowList :: [RecordActivityTaskHeartbeatResponse] -> ShowS
show :: RecordActivityTaskHeartbeatResponse -> String
$cshow :: RecordActivityTaskHeartbeatResponse -> String
showsPrec :: Int -> RecordActivityTaskHeartbeatResponse -> ShowS
$cshowsPrec :: Int -> RecordActivityTaskHeartbeatResponse -> ShowS
Prelude.Show, forall x.
Rep RecordActivityTaskHeartbeatResponse x
-> RecordActivityTaskHeartbeatResponse
forall x.
RecordActivityTaskHeartbeatResponse
-> Rep RecordActivityTaskHeartbeatResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RecordActivityTaskHeartbeatResponse x
-> RecordActivityTaskHeartbeatResponse
$cfrom :: forall x.
RecordActivityTaskHeartbeatResponse
-> Rep RecordActivityTaskHeartbeatResponse x
Prelude.Generic)

-- |
-- Create a value of 'RecordActivityTaskHeartbeatResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'recordActivityTaskHeartbeatResponse_httpStatus' - The response's http status code.
--
-- 'cancelRequested', 'recordActivityTaskHeartbeatResponse_cancelRequested' - Set to @true@ if cancellation of the task is requested.
newRecordActivityTaskHeartbeatResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'cancelRequested'
  Prelude.Bool ->
  RecordActivityTaskHeartbeatResponse
newRecordActivityTaskHeartbeatResponse :: Int -> Bool -> RecordActivityTaskHeartbeatResponse
newRecordActivityTaskHeartbeatResponse
  Int
pHttpStatus_
  Bool
pCancelRequested_ =
    RecordActivityTaskHeartbeatResponse'
      { $sel:httpStatus:RecordActivityTaskHeartbeatResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:cancelRequested:RecordActivityTaskHeartbeatResponse' :: Bool
cancelRequested = Bool
pCancelRequested_
      }

-- | The response's http status code.
recordActivityTaskHeartbeatResponse_httpStatus :: Lens.Lens' RecordActivityTaskHeartbeatResponse Prelude.Int
recordActivityTaskHeartbeatResponse_httpStatus :: Lens' RecordActivityTaskHeartbeatResponse Int
recordActivityTaskHeartbeatResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordActivityTaskHeartbeatResponse' {Int
httpStatus :: Int
$sel:httpStatus:RecordActivityTaskHeartbeatResponse' :: RecordActivityTaskHeartbeatResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RecordActivityTaskHeartbeatResponse
s@RecordActivityTaskHeartbeatResponse' {} Int
a -> RecordActivityTaskHeartbeatResponse
s {$sel:httpStatus:RecordActivityTaskHeartbeatResponse' :: Int
httpStatus = Int
a} :: RecordActivityTaskHeartbeatResponse)

-- | Set to @true@ if cancellation of the task is requested.
recordActivityTaskHeartbeatResponse_cancelRequested :: Lens.Lens' RecordActivityTaskHeartbeatResponse Prelude.Bool
recordActivityTaskHeartbeatResponse_cancelRequested :: Lens' RecordActivityTaskHeartbeatResponse Bool
recordActivityTaskHeartbeatResponse_cancelRequested = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordActivityTaskHeartbeatResponse' {Bool
cancelRequested :: Bool
$sel:cancelRequested:RecordActivityTaskHeartbeatResponse' :: RecordActivityTaskHeartbeatResponse -> Bool
cancelRequested} -> Bool
cancelRequested) (\s :: RecordActivityTaskHeartbeatResponse
s@RecordActivityTaskHeartbeatResponse' {} Bool
a -> RecordActivityTaskHeartbeatResponse
s {$sel:cancelRequested:RecordActivityTaskHeartbeatResponse' :: Bool
cancelRequested = Bool
a} :: RecordActivityTaskHeartbeatResponse)

instance
  Prelude.NFData
    RecordActivityTaskHeartbeatResponse
  where
  rnf :: RecordActivityTaskHeartbeatResponse -> ()
rnf RecordActivityTaskHeartbeatResponse' {Bool
Int
cancelRequested :: Bool
httpStatus :: Int
$sel:cancelRequested:RecordActivityTaskHeartbeatResponse' :: RecordActivityTaskHeartbeatResponse -> Bool
$sel:httpStatus:RecordActivityTaskHeartbeatResponse' :: RecordActivityTaskHeartbeatResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
cancelRequested