{-# 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.ResumeContactRecording
-- 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)
--
-- When a contact is being recorded, and the recording has been suspended
-- using SuspendContactRecording, this API resumes recording the call.
--
-- Only voice recordings are supported at this time.
module Amazonka.Connect.ResumeContactRecording
  ( -- * Creating a Request
    ResumeContactRecording (..),
    newResumeContactRecording,

    -- * Request Lenses
    resumeContactRecording_instanceId,
    resumeContactRecording_contactId,
    resumeContactRecording_initialContactId,

    -- * Destructuring the Response
    ResumeContactRecordingResponse (..),
    newResumeContactRecordingResponse,

    -- * Response Lenses
    resumeContactRecordingResponse_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:/ 'newResumeContactRecording' smart constructor.
data ResumeContactRecording = ResumeContactRecording'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    ResumeContactRecording -> Text
instanceId :: Prelude.Text,
    -- | The identifier of the contact.
    ResumeContactRecording -> 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.
    ResumeContactRecording -> Text
initialContactId :: Prelude.Text
  }
  deriving (ResumeContactRecording -> ResumeContactRecording -> Bool
(ResumeContactRecording -> ResumeContactRecording -> Bool)
-> (ResumeContactRecording -> ResumeContactRecording -> Bool)
-> Eq ResumeContactRecording
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResumeContactRecording -> ResumeContactRecording -> Bool
$c/= :: ResumeContactRecording -> ResumeContactRecording -> Bool
== :: ResumeContactRecording -> ResumeContactRecording -> Bool
$c== :: ResumeContactRecording -> ResumeContactRecording -> Bool
Prelude.Eq, ReadPrec [ResumeContactRecording]
ReadPrec ResumeContactRecording
Int -> ReadS ResumeContactRecording
ReadS [ResumeContactRecording]
(Int -> ReadS ResumeContactRecording)
-> ReadS [ResumeContactRecording]
-> ReadPrec ResumeContactRecording
-> ReadPrec [ResumeContactRecording]
-> Read ResumeContactRecording
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResumeContactRecording]
$creadListPrec :: ReadPrec [ResumeContactRecording]
readPrec :: ReadPrec ResumeContactRecording
$creadPrec :: ReadPrec ResumeContactRecording
readList :: ReadS [ResumeContactRecording]
$creadList :: ReadS [ResumeContactRecording]
readsPrec :: Int -> ReadS ResumeContactRecording
$creadsPrec :: Int -> ReadS ResumeContactRecording
Prelude.Read, Int -> ResumeContactRecording -> ShowS
[ResumeContactRecording] -> ShowS
ResumeContactRecording -> String
(Int -> ResumeContactRecording -> ShowS)
-> (ResumeContactRecording -> String)
-> ([ResumeContactRecording] -> ShowS)
-> Show ResumeContactRecording
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResumeContactRecording] -> ShowS
$cshowList :: [ResumeContactRecording] -> ShowS
show :: ResumeContactRecording -> String
$cshow :: ResumeContactRecording -> String
showsPrec :: Int -> ResumeContactRecording -> ShowS
$cshowsPrec :: Int -> ResumeContactRecording -> ShowS
Prelude.Show, (forall x. ResumeContactRecording -> Rep ResumeContactRecording x)
-> (forall x.
    Rep ResumeContactRecording x -> ResumeContactRecording)
-> Generic ResumeContactRecording
forall x. Rep ResumeContactRecording x -> ResumeContactRecording
forall x. ResumeContactRecording -> Rep ResumeContactRecording x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResumeContactRecording x -> ResumeContactRecording
$cfrom :: forall x. ResumeContactRecording -> Rep ResumeContactRecording x
Prelude.Generic)

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

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

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

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

instance Core.AWSRequest ResumeContactRecording where
  type
    AWSResponse ResumeContactRecording =
      ResumeContactRecordingResponse
  request :: ResumeContactRecording -> Request ResumeContactRecording
request = Service -> ResumeContactRecording -> Request ResumeContactRecording
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ResumeContactRecording
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ResumeContactRecording)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse ResumeContactRecording))
-> Logger
-> Service
-> Proxy ResumeContactRecording
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ResumeContactRecording)))
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 -> ResumeContactRecordingResponse
ResumeContactRecordingResponse'
            (Int -> ResumeContactRecordingResponse)
-> Either String Int
-> Either String ResumeContactRecordingResponse
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 ResumeContactRecording

instance Prelude.NFData ResumeContactRecording

instance Core.ToHeaders ResumeContactRecording where
  toHeaders :: ResumeContactRecording -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ResumeContactRecording -> 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 ResumeContactRecording where
  toJSON :: ResumeContactRecording -> Value
toJSON ResumeContactRecording' {Text
initialContactId :: Text
contactId :: Text
instanceId :: Text
$sel:initialContactId:ResumeContactRecording' :: ResumeContactRecording -> Text
$sel:contactId:ResumeContactRecording' :: ResumeContactRecording -> Text
$sel:instanceId:ResumeContactRecording' :: ResumeContactRecording -> 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 ResumeContactRecording where
  toPath :: ResumeContactRecording -> ByteString
toPath = ByteString -> ResumeContactRecording -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/contact/resume-recording"

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

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

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

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

instance
  Prelude.NFData
    ResumeContactRecordingResponse