{-# 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.DescribeContactFlow
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the specified flow.
--
-- You can also create and update flows using the
-- <https://docs.aws.amazon.com/connect/latest/APIReference/flow-language.html Amazon Connect Flow language>.
module Amazonka.Connect.DescribeContactFlow
  ( -- * Creating a Request
    DescribeContactFlow (..),
    newDescribeContactFlow,

    -- * Request Lenses
    describeContactFlow_instanceId,
    describeContactFlow_contactFlowId,

    -- * Destructuring the Response
    DescribeContactFlowResponse (..),
    newDescribeContactFlowResponse,

    -- * Response Lenses
    describeContactFlowResponse_contactFlow,
    describeContactFlowResponse_httpStatus,
  )
where

import Amazonka.Connect.Types
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

-- | /See:/ 'newDescribeContactFlow' smart constructor.
data DescribeContactFlow = DescribeContactFlow'
  { -- | The identifier of the Amazon Connect instance.
    DescribeContactFlow -> Text
instanceId :: Prelude.Text,
    -- | The identifier of the flow.
    DescribeContactFlow -> Text
contactFlowId :: Prelude.Text
  }
  deriving (DescribeContactFlow -> DescribeContactFlow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeContactFlow -> DescribeContactFlow -> Bool
$c/= :: DescribeContactFlow -> DescribeContactFlow -> Bool
== :: DescribeContactFlow -> DescribeContactFlow -> Bool
$c== :: DescribeContactFlow -> DescribeContactFlow -> Bool
Prelude.Eq, ReadPrec [DescribeContactFlow]
ReadPrec DescribeContactFlow
Int -> ReadS DescribeContactFlow
ReadS [DescribeContactFlow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeContactFlow]
$creadListPrec :: ReadPrec [DescribeContactFlow]
readPrec :: ReadPrec DescribeContactFlow
$creadPrec :: ReadPrec DescribeContactFlow
readList :: ReadS [DescribeContactFlow]
$creadList :: ReadS [DescribeContactFlow]
readsPrec :: Int -> ReadS DescribeContactFlow
$creadsPrec :: Int -> ReadS DescribeContactFlow
Prelude.Read, Int -> DescribeContactFlow -> ShowS
[DescribeContactFlow] -> ShowS
DescribeContactFlow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeContactFlow] -> ShowS
$cshowList :: [DescribeContactFlow] -> ShowS
show :: DescribeContactFlow -> String
$cshow :: DescribeContactFlow -> String
showsPrec :: Int -> DescribeContactFlow -> ShowS
$cshowsPrec :: Int -> DescribeContactFlow -> ShowS
Prelude.Show, forall x. Rep DescribeContactFlow x -> DescribeContactFlow
forall x. DescribeContactFlow -> Rep DescribeContactFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeContactFlow x -> DescribeContactFlow
$cfrom :: forall x. DescribeContactFlow -> Rep DescribeContactFlow x
Prelude.Generic)

-- |
-- Create a value of 'DescribeContactFlow' 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', 'describeContactFlow_instanceId' - The identifier of the Amazon Connect instance.
--
-- 'contactFlowId', 'describeContactFlow_contactFlowId' - The identifier of the flow.
newDescribeContactFlow ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'contactFlowId'
  Prelude.Text ->
  DescribeContactFlow
newDescribeContactFlow :: Text -> Text -> DescribeContactFlow
newDescribeContactFlow Text
pInstanceId_ Text
pContactFlowId_ =
  DescribeContactFlow'
    { $sel:instanceId:DescribeContactFlow' :: Text
instanceId = Text
pInstanceId_,
      $sel:contactFlowId:DescribeContactFlow' :: Text
contactFlowId = Text
pContactFlowId_
    }

-- | The identifier of the Amazon Connect instance.
describeContactFlow_instanceId :: Lens.Lens' DescribeContactFlow Prelude.Text
describeContactFlow_instanceId :: Lens' DescribeContactFlow Text
describeContactFlow_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContactFlow' {Text
instanceId :: Text
$sel:instanceId:DescribeContactFlow' :: DescribeContactFlow -> Text
instanceId} -> Text
instanceId) (\s :: DescribeContactFlow
s@DescribeContactFlow' {} Text
a -> DescribeContactFlow
s {$sel:instanceId:DescribeContactFlow' :: Text
instanceId = Text
a} :: DescribeContactFlow)

-- | The identifier of the flow.
describeContactFlow_contactFlowId :: Lens.Lens' DescribeContactFlow Prelude.Text
describeContactFlow_contactFlowId :: Lens' DescribeContactFlow Text
describeContactFlow_contactFlowId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContactFlow' {Text
contactFlowId :: Text
$sel:contactFlowId:DescribeContactFlow' :: DescribeContactFlow -> Text
contactFlowId} -> Text
contactFlowId) (\s :: DescribeContactFlow
s@DescribeContactFlow' {} Text
a -> DescribeContactFlow
s {$sel:contactFlowId:DescribeContactFlow' :: Text
contactFlowId = Text
a} :: DescribeContactFlow)

instance Core.AWSRequest DescribeContactFlow where
  type
    AWSResponse DescribeContactFlow =
      DescribeContactFlowResponse
  request :: (Service -> Service)
-> DescribeContactFlow -> Request DescribeContactFlow
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeContactFlow
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeContactFlow)))
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 ->
          Maybe ContactFlow -> Int -> DescribeContactFlowResponse
DescribeContactFlowResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ContactFlow")
            forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable DescribeContactFlow where
  hashWithSalt :: Int -> DescribeContactFlow -> Int
hashWithSalt Int
_salt DescribeContactFlow' {Text
contactFlowId :: Text
instanceId :: Text
$sel:contactFlowId:DescribeContactFlow' :: DescribeContactFlow -> Text
$sel:instanceId:DescribeContactFlow' :: DescribeContactFlow -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactFlowId

instance Prelude.NFData DescribeContactFlow where
  rnf :: DescribeContactFlow -> ()
rnf DescribeContactFlow' {Text
contactFlowId :: Text
instanceId :: Text
$sel:contactFlowId:DescribeContactFlow' :: DescribeContactFlow -> Text
$sel:instanceId:DescribeContactFlow' :: DescribeContactFlow -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contactFlowId

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

instance Data.ToPath DescribeContactFlow where
  toPath :: DescribeContactFlow -> ByteString
toPath DescribeContactFlow' {Text
contactFlowId :: Text
instanceId :: Text
$sel:contactFlowId:DescribeContactFlow' :: DescribeContactFlow -> Text
$sel:instanceId:DescribeContactFlow' :: DescribeContactFlow -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/contact-flows/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
        ByteString
"/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
contactFlowId
      ]

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

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

-- |
-- Create a value of 'DescribeContactFlowResponse' 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:
--
-- 'contactFlow', 'describeContactFlowResponse_contactFlow' - Information about the flow.
--
-- 'httpStatus', 'describeContactFlowResponse_httpStatus' - The response's http status code.
newDescribeContactFlowResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeContactFlowResponse
newDescribeContactFlowResponse :: Int -> DescribeContactFlowResponse
newDescribeContactFlowResponse Int
pHttpStatus_ =
  DescribeContactFlowResponse'
    { $sel:contactFlow:DescribeContactFlowResponse' :: Maybe ContactFlow
contactFlow =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeContactFlowResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the flow.
describeContactFlowResponse_contactFlow :: Lens.Lens' DescribeContactFlowResponse (Prelude.Maybe ContactFlow)
describeContactFlowResponse_contactFlow :: Lens' DescribeContactFlowResponse (Maybe ContactFlow)
describeContactFlowResponse_contactFlow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContactFlowResponse' {Maybe ContactFlow
contactFlow :: Maybe ContactFlow
$sel:contactFlow:DescribeContactFlowResponse' :: DescribeContactFlowResponse -> Maybe ContactFlow
contactFlow} -> Maybe ContactFlow
contactFlow) (\s :: DescribeContactFlowResponse
s@DescribeContactFlowResponse' {} Maybe ContactFlow
a -> DescribeContactFlowResponse
s {$sel:contactFlow:DescribeContactFlowResponse' :: Maybe ContactFlow
contactFlow = Maybe ContactFlow
a} :: DescribeContactFlowResponse)

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

instance Prelude.NFData DescribeContactFlowResponse where
  rnf :: DescribeContactFlowResponse -> ()
rnf DescribeContactFlowResponse' {Int
Maybe ContactFlow
httpStatus :: Int
contactFlow :: Maybe ContactFlow
$sel:httpStatus:DescribeContactFlowResponse' :: DescribeContactFlowResponse -> Int
$sel:contactFlow:DescribeContactFlowResponse' :: DescribeContactFlowResponse -> Maybe ContactFlow
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ContactFlow
contactFlow
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus