{-# 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.Connect.StopContactRecording
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops recording a call when a contact is being recorded.
-- StopContactRecording is a one-time action. If you use
-- StopContactRecording to stop recording an ongoing call, you can\'t use
-- StartContactRecording to restart it. For scenarios where the recording
-- has started and you want to suspend it for sensitive information (for
-- example, to collect a credit card number), and then restart it, use
-- SuspendContactRecording and ResumeContactRecording.
--
-- Only voice recordings are supported at this time.
module Amazonka.Connect.StopContactRecording
  ( -- * Creating a Request
    StopContactRecording (..),
    newStopContactRecording,

    -- * Request Lenses
    stopContactRecording_instanceId,
    stopContactRecording_contactId,
    stopContactRecording_initialContactId,

    -- * Destructuring the Response
    StopContactRecordingResponse (..),
    newStopContactRecordingResponse,

    -- * Response Lenses
    stopContactRecordingResponse_httpStatus,
  )
where

import Amazonka.Connect.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newStopContactRecording' smart constructor.
data StopContactRecording = StopContactRecording'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    StopContactRecording -> Text
instanceId :: Prelude.Text,
    -- | The identifier of the contact.
    StopContactRecording -> Text
contactId :: Prelude.Text,
    -- | The identifier of the contact. This is the identifier of the contact
    -- associated with the first interaction with the contact center.
    StopContactRecording -> Text
initialContactId :: Prelude.Text
  }
  deriving (StopContactRecording -> StopContactRecording -> Bool
(StopContactRecording -> StopContactRecording -> Bool)
-> (StopContactRecording -> StopContactRecording -> Bool)
-> Eq StopContactRecording
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopContactRecording -> StopContactRecording -> Bool
$c/= :: StopContactRecording -> StopContactRecording -> Bool
== :: StopContactRecording -> StopContactRecording -> Bool
$c== :: StopContactRecording -> StopContactRecording -> Bool
Prelude.Eq, ReadPrec [StopContactRecording]
ReadPrec StopContactRecording
Int -> ReadS StopContactRecording
ReadS [StopContactRecording]
(Int -> ReadS StopContactRecording)
-> ReadS [StopContactRecording]
-> ReadPrec StopContactRecording
-> ReadPrec [StopContactRecording]
-> Read StopContactRecording
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopContactRecording]
$creadListPrec :: ReadPrec [StopContactRecording]
readPrec :: ReadPrec StopContactRecording
$creadPrec :: ReadPrec StopContactRecording
readList :: ReadS [StopContactRecording]
$creadList :: ReadS [StopContactRecording]
readsPrec :: Int -> ReadS StopContactRecording
$creadsPrec :: Int -> ReadS StopContactRecording
Prelude.Read, Int -> StopContactRecording -> ShowS
[StopContactRecording] -> ShowS
StopContactRecording -> String
(Int -> StopContactRecording -> ShowS)
-> (StopContactRecording -> String)
-> ([StopContactRecording] -> ShowS)
-> Show StopContactRecording
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopContactRecording] -> ShowS
$cshowList :: [StopContactRecording] -> ShowS
show :: StopContactRecording -> String
$cshow :: StopContactRecording -> String
showsPrec :: Int -> StopContactRecording -> ShowS
$cshowsPrec :: Int -> StopContactRecording -> ShowS
Prelude.Show, (forall x. StopContactRecording -> Rep StopContactRecording x)
-> (forall x. Rep StopContactRecording x -> StopContactRecording)
-> Generic StopContactRecording
forall x. Rep StopContactRecording x -> StopContactRecording
forall x. StopContactRecording -> Rep StopContactRecording x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopContactRecording x -> StopContactRecording
$cfrom :: forall x. StopContactRecording -> Rep StopContactRecording x
Prelude.Generic)

-- |
-- Create a value of 'StopContactRecording' 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:
--
-- 'instanceId', 'stopContactRecording_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'contactId', 'stopContactRecording_contactId' - The identifier of the contact.
--
-- 'initialContactId', 'stopContactRecording_initialContactId' - The identifier of the contact. This is the identifier of the contact
-- associated with the first interaction with the contact center.
newStopContactRecording ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'contactId'
  Prelude.Text ->
  -- | 'initialContactId'
  Prelude.Text ->
  StopContactRecording
newStopContactRecording :: Text -> Text -> Text -> StopContactRecording
newStopContactRecording
  Text
pInstanceId_
  Text
pContactId_
  Text
pInitialContactId_ =
    StopContactRecording' :: Text -> Text -> Text -> StopContactRecording
StopContactRecording'
      { $sel:instanceId:StopContactRecording' :: Text
instanceId = Text
pInstanceId_,
        $sel:contactId:StopContactRecording' :: Text
contactId = Text
pContactId_,
        $sel:initialContactId:StopContactRecording' :: Text
initialContactId = Text
pInitialContactId_
      }

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
stopContactRecording_instanceId :: Lens.Lens' StopContactRecording Prelude.Text
stopContactRecording_instanceId :: (Text -> f Text) -> StopContactRecording -> f StopContactRecording
stopContactRecording_instanceId = (StopContactRecording -> Text)
-> (StopContactRecording -> Text -> StopContactRecording)
-> Lens StopContactRecording StopContactRecording Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopContactRecording' {Text
instanceId :: Text
$sel:instanceId:StopContactRecording' :: StopContactRecording -> Text
instanceId} -> Text
instanceId) (\s :: StopContactRecording
s@StopContactRecording' {} Text
a -> StopContactRecording
s {$sel:instanceId:StopContactRecording' :: Text
instanceId = Text
a} :: StopContactRecording)

-- | The identifier of the contact.
stopContactRecording_contactId :: Lens.Lens' StopContactRecording Prelude.Text
stopContactRecording_contactId :: (Text -> f Text) -> StopContactRecording -> f StopContactRecording
stopContactRecording_contactId = (StopContactRecording -> Text)
-> (StopContactRecording -> Text -> StopContactRecording)
-> Lens StopContactRecording StopContactRecording Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopContactRecording' {Text
contactId :: Text
$sel:contactId:StopContactRecording' :: StopContactRecording -> Text
contactId} -> Text
contactId) (\s :: StopContactRecording
s@StopContactRecording' {} Text
a -> StopContactRecording
s {$sel:contactId:StopContactRecording' :: Text
contactId = Text
a} :: StopContactRecording)

-- | The identifier of the contact. This is the identifier of the contact
-- associated with the first interaction with the contact center.
stopContactRecording_initialContactId :: Lens.Lens' StopContactRecording Prelude.Text
stopContactRecording_initialContactId :: (Text -> f Text) -> StopContactRecording -> f StopContactRecording
stopContactRecording_initialContactId = (StopContactRecording -> Text)
-> (StopContactRecording -> Text -> StopContactRecording)
-> Lens StopContactRecording StopContactRecording Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopContactRecording' {Text
initialContactId :: Text
$sel:initialContactId:StopContactRecording' :: StopContactRecording -> Text
initialContactId} -> Text
initialContactId) (\s :: StopContactRecording
s@StopContactRecording' {} Text
a -> StopContactRecording
s {$sel:initialContactId:StopContactRecording' :: Text
initialContactId = Text
a} :: StopContactRecording)

instance Core.AWSRequest StopContactRecording where
  type
    AWSResponse StopContactRecording =
      StopContactRecordingResponse
  request :: StopContactRecording -> Request StopContactRecording
request = Service -> StopContactRecording -> Request StopContactRecording
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopContactRecording
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopContactRecording)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse StopContactRecording))
-> Logger
-> Service
-> Proxy StopContactRecording
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopContactRecording)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> StopContactRecordingResponse
StopContactRecordingResponse'
            (Int -> StopContactRecordingResponse)
-> Either String Int -> Either String StopContactRecordingResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StopContactRecording

instance Prelude.NFData StopContactRecording

instance Core.ToHeaders StopContactRecording where
  toHeaders :: StopContactRecording -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StopContactRecording -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON StopContactRecording where
  toJSON :: StopContactRecording -> Value
toJSON StopContactRecording' {Text
initialContactId :: Text
contactId :: Text
instanceId :: Text
$sel:initialContactId:StopContactRecording' :: StopContactRecording -> Text
$sel:contactId:StopContactRecording' :: StopContactRecording -> Text
$sel:instanceId:StopContactRecording' :: StopContactRecording -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ContactId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contactId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"InitialContactId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
initialContactId)
          ]
      )

instance Core.ToPath StopContactRecording where
  toPath :: StopContactRecording -> ByteString
toPath = ByteString -> StopContactRecording -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/contact/stop-recording"

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

-- | /See:/ 'newStopContactRecordingResponse' smart constructor.
data StopContactRecordingResponse = StopContactRecordingResponse'
  { -- | The response's http status code.
    StopContactRecordingResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StopContactRecordingResponse
-> StopContactRecordingResponse -> Bool
(StopContactRecordingResponse
 -> StopContactRecordingResponse -> Bool)
-> (StopContactRecordingResponse
    -> StopContactRecordingResponse -> Bool)
-> Eq StopContactRecordingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopContactRecordingResponse
-> StopContactRecordingResponse -> Bool
$c/= :: StopContactRecordingResponse
-> StopContactRecordingResponse -> Bool
== :: StopContactRecordingResponse
-> StopContactRecordingResponse -> Bool
$c== :: StopContactRecordingResponse
-> StopContactRecordingResponse -> Bool
Prelude.Eq, ReadPrec [StopContactRecordingResponse]
ReadPrec StopContactRecordingResponse
Int -> ReadS StopContactRecordingResponse
ReadS [StopContactRecordingResponse]
(Int -> ReadS StopContactRecordingResponse)
-> ReadS [StopContactRecordingResponse]
-> ReadPrec StopContactRecordingResponse
-> ReadPrec [StopContactRecordingResponse]
-> Read StopContactRecordingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopContactRecordingResponse]
$creadListPrec :: ReadPrec [StopContactRecordingResponse]
readPrec :: ReadPrec StopContactRecordingResponse
$creadPrec :: ReadPrec StopContactRecordingResponse
readList :: ReadS [StopContactRecordingResponse]
$creadList :: ReadS [StopContactRecordingResponse]
readsPrec :: Int -> ReadS StopContactRecordingResponse
$creadsPrec :: Int -> ReadS StopContactRecordingResponse
Prelude.Read, Int -> StopContactRecordingResponse -> ShowS
[StopContactRecordingResponse] -> ShowS
StopContactRecordingResponse -> String
(Int -> StopContactRecordingResponse -> ShowS)
-> (StopContactRecordingResponse -> String)
-> ([StopContactRecordingResponse] -> ShowS)
-> Show StopContactRecordingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopContactRecordingResponse] -> ShowS
$cshowList :: [StopContactRecordingResponse] -> ShowS
show :: StopContactRecordingResponse -> String
$cshow :: StopContactRecordingResponse -> String
showsPrec :: Int -> StopContactRecordingResponse -> ShowS
$cshowsPrec :: Int -> StopContactRecordingResponse -> ShowS
Prelude.Show, (forall x.
 StopContactRecordingResponse -> Rep StopContactRecordingResponse x)
-> (forall x.
    Rep StopContactRecordingResponse x -> StopContactRecordingResponse)
-> Generic StopContactRecordingResponse
forall x.
Rep StopContactRecordingResponse x -> StopContactRecordingResponse
forall x.
StopContactRecordingResponse -> Rep StopContactRecordingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopContactRecordingResponse x -> StopContactRecordingResponse
$cfrom :: forall x.
StopContactRecordingResponse -> Rep StopContactRecordingResponse x
Prelude.Generic)

-- |
-- Create a value of 'StopContactRecordingResponse' 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', 'stopContactRecordingResponse_httpStatus' - The response's http status code.
newStopContactRecordingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StopContactRecordingResponse
newStopContactRecordingResponse :: Int -> StopContactRecordingResponse
newStopContactRecordingResponse Int
pHttpStatus_ =
  StopContactRecordingResponse' :: Int -> StopContactRecordingResponse
StopContactRecordingResponse'
    { $sel:httpStatus:StopContactRecordingResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData StopContactRecordingResponse