{-# 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.DescribeContactFlowModule
-- 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 module.
module Amazonka.Connect.DescribeContactFlowModule
  ( -- * Creating a Request
    DescribeContactFlowModule (..),
    newDescribeContactFlowModule,

    -- * Request Lenses
    describeContactFlowModule_instanceId,
    describeContactFlowModule_contactFlowModuleId,

    -- * Destructuring the Response
    DescribeContactFlowModuleResponse (..),
    newDescribeContactFlowModuleResponse,

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

-- |
-- Create a value of 'DescribeContactFlowModule' 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', 'describeContactFlowModule_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'contactFlowModuleId', 'describeContactFlowModule_contactFlowModuleId' - The identifier of the flow module.
newDescribeContactFlowModule ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'contactFlowModuleId'
  Prelude.Text ->
  DescribeContactFlowModule
newDescribeContactFlowModule :: Text -> Text -> DescribeContactFlowModule
newDescribeContactFlowModule
  Text
pInstanceId_
  Text
pContactFlowModuleId_ =
    DescribeContactFlowModule'
      { $sel:instanceId:DescribeContactFlowModule' :: Text
instanceId =
          Text
pInstanceId_,
        $sel:contactFlowModuleId:DescribeContactFlowModule' :: Text
contactFlowModuleId = Text
pContactFlowModuleId_
      }

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

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

instance Core.AWSRequest DescribeContactFlowModule where
  type
    AWSResponse DescribeContactFlowModule =
      DescribeContactFlowModuleResponse
  request :: (Service -> Service)
-> DescribeContactFlowModule -> Request DescribeContactFlowModule
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 DescribeContactFlowModule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeContactFlowModule)))
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 ContactFlowModule -> Int -> DescribeContactFlowModuleResponse
DescribeContactFlowModuleResponse'
            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
"ContactFlowModule")
            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 DescribeContactFlowModule where
  hashWithSalt :: Int -> DescribeContactFlowModule -> Int
hashWithSalt Int
_salt DescribeContactFlowModule' {Text
contactFlowModuleId :: Text
instanceId :: Text
$sel:contactFlowModuleId:DescribeContactFlowModule' :: DescribeContactFlowModule -> Text
$sel:instanceId:DescribeContactFlowModule' :: DescribeContactFlowModule -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactFlowModuleId

instance Prelude.NFData DescribeContactFlowModule where
  rnf :: DescribeContactFlowModule -> ()
rnf DescribeContactFlowModule' {Text
contactFlowModuleId :: Text
instanceId :: Text
$sel:contactFlowModuleId:DescribeContactFlowModule' :: DescribeContactFlowModule -> Text
$sel:instanceId:DescribeContactFlowModule' :: DescribeContactFlowModule -> 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
contactFlowModuleId

instance Data.ToHeaders DescribeContactFlowModule where
  toHeaders :: DescribeContactFlowModule -> 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 DescribeContactFlowModule where
  toPath :: DescribeContactFlowModule -> ByteString
toPath DescribeContactFlowModule' {Text
contactFlowModuleId :: Text
instanceId :: Text
$sel:contactFlowModuleId:DescribeContactFlowModule' :: DescribeContactFlowModule -> Text
$sel:instanceId:DescribeContactFlowModule' :: DescribeContactFlowModule -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/contact-flow-modules/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
        ByteString
"/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
contactFlowModuleId
      ]

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

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

-- |
-- Create a value of 'DescribeContactFlowModuleResponse' 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:
--
-- 'contactFlowModule', 'describeContactFlowModuleResponse_contactFlowModule' - Information about the flow module.
--
-- 'httpStatus', 'describeContactFlowModuleResponse_httpStatus' - The response's http status code.
newDescribeContactFlowModuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeContactFlowModuleResponse
newDescribeContactFlowModuleResponse :: Int -> DescribeContactFlowModuleResponse
newDescribeContactFlowModuleResponse Int
pHttpStatus_ =
  DescribeContactFlowModuleResponse'
    { $sel:contactFlowModule:DescribeContactFlowModuleResponse' :: Maybe ContactFlowModule
contactFlowModule =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeContactFlowModuleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the flow module.
describeContactFlowModuleResponse_contactFlowModule :: Lens.Lens' DescribeContactFlowModuleResponse (Prelude.Maybe ContactFlowModule)
describeContactFlowModuleResponse_contactFlowModule :: Lens' DescribeContactFlowModuleResponse (Maybe ContactFlowModule)
describeContactFlowModuleResponse_contactFlowModule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContactFlowModuleResponse' {Maybe ContactFlowModule
contactFlowModule :: Maybe ContactFlowModule
$sel:contactFlowModule:DescribeContactFlowModuleResponse' :: DescribeContactFlowModuleResponse -> Maybe ContactFlowModule
contactFlowModule} -> Maybe ContactFlowModule
contactFlowModule) (\s :: DescribeContactFlowModuleResponse
s@DescribeContactFlowModuleResponse' {} Maybe ContactFlowModule
a -> DescribeContactFlowModuleResponse
s {$sel:contactFlowModule:DescribeContactFlowModuleResponse' :: Maybe ContactFlowModule
contactFlowModule = Maybe ContactFlowModule
a} :: DescribeContactFlowModuleResponse)

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

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