{-# 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.StopContact
-- 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)
--
-- Ends the specified contact.
module Amazonka.Connect.StopContact
  ( -- * Creating a Request
    StopContact (..),
    newStopContact,

    -- * Request Lenses
    stopContact_contactId,
    stopContact_instanceId,

    -- * Destructuring the Response
    StopContactResponse (..),
    newStopContactResponse,

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

-- |
-- Create a value of 'StopContact' 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:
--
-- 'contactId', 'stopContact_contactId' - The ID of the contact.
--
-- 'instanceId', 'stopContact_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newStopContact ::
  -- | 'contactId'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  StopContact
newStopContact :: Text -> Text -> StopContact
newStopContact Text
pContactId_ Text
pInstanceId_ =
  StopContact' :: Text -> Text -> StopContact
StopContact'
    { $sel:contactId:StopContact' :: Text
contactId = Text
pContactId_,
      $sel:instanceId:StopContact' :: Text
instanceId = Text
pInstanceId_
    }

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

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

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

instance Prelude.NFData StopContact

instance Core.ToHeaders StopContact where
  toHeaders :: StopContact -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StopContact -> 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 StopContact where
  toJSON :: StopContact -> Value
toJSON StopContact' {Text
instanceId :: Text
contactId :: Text
$sel:instanceId:StopContact' :: StopContact -> Text
$sel:contactId:StopContact' :: StopContact -> 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
"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
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId)
          ]
      )

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

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

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

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

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

instance Prelude.NFData StopContactResponse