{-# 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.VoiceId.DescribeFraudster
-- 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)
--
-- Describes the specified fraudster.
module Amazonka.VoiceId.DescribeFraudster
  ( -- * Creating a Request
    DescribeFraudster (..),
    newDescribeFraudster,

    -- * Request Lenses
    describeFraudster_domainId,
    describeFraudster_fraudsterId,

    -- * Destructuring the Response
    DescribeFraudsterResponse (..),
    newDescribeFraudsterResponse,

    -- * Response Lenses
    describeFraudsterResponse_fraudster,
    describeFraudsterResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeFraudster' smart constructor.
data DescribeFraudster = DescribeFraudster'
  { -- | The identifier of the domain containing the fraudster.
    DescribeFraudster -> Text
domainId :: Prelude.Text,
    -- | The identifier of the fraudster you are describing.
    DescribeFraudster -> Sensitive Text
fraudsterId :: Core.Sensitive Prelude.Text
  }
  deriving (DescribeFraudster -> DescribeFraudster -> Bool
(DescribeFraudster -> DescribeFraudster -> Bool)
-> (DescribeFraudster -> DescribeFraudster -> Bool)
-> Eq DescribeFraudster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFraudster -> DescribeFraudster -> Bool
$c/= :: DescribeFraudster -> DescribeFraudster -> Bool
== :: DescribeFraudster -> DescribeFraudster -> Bool
$c== :: DescribeFraudster -> DescribeFraudster -> Bool
Prelude.Eq, Int -> DescribeFraudster -> ShowS
[DescribeFraudster] -> ShowS
DescribeFraudster -> String
(Int -> DescribeFraudster -> ShowS)
-> (DescribeFraudster -> String)
-> ([DescribeFraudster] -> ShowS)
-> Show DescribeFraudster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFraudster] -> ShowS
$cshowList :: [DescribeFraudster] -> ShowS
show :: DescribeFraudster -> String
$cshow :: DescribeFraudster -> String
showsPrec :: Int -> DescribeFraudster -> ShowS
$cshowsPrec :: Int -> DescribeFraudster -> ShowS
Prelude.Show, (forall x. DescribeFraudster -> Rep DescribeFraudster x)
-> (forall x. Rep DescribeFraudster x -> DescribeFraudster)
-> Generic DescribeFraudster
forall x. Rep DescribeFraudster x -> DescribeFraudster
forall x. DescribeFraudster -> Rep DescribeFraudster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFraudster x -> DescribeFraudster
$cfrom :: forall x. DescribeFraudster -> Rep DescribeFraudster x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFraudster' 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:
--
-- 'domainId', 'describeFraudster_domainId' - The identifier of the domain containing the fraudster.
--
-- 'fraudsterId', 'describeFraudster_fraudsterId' - The identifier of the fraudster you are describing.
newDescribeFraudster ::
  -- | 'domainId'
  Prelude.Text ->
  -- | 'fraudsterId'
  Prelude.Text ->
  DescribeFraudster
newDescribeFraudster :: Text -> Text -> DescribeFraudster
newDescribeFraudster Text
pDomainId_ Text
pFraudsterId_ =
  DescribeFraudster' :: Text -> Sensitive Text -> DescribeFraudster
DescribeFraudster'
    { $sel:domainId:DescribeFraudster' :: Text
domainId = Text
pDomainId_,
      $sel:fraudsterId:DescribeFraudster' :: Sensitive Text
fraudsterId = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pFraudsterId_
    }

-- | The identifier of the domain containing the fraudster.
describeFraudster_domainId :: Lens.Lens' DescribeFraudster Prelude.Text
describeFraudster_domainId :: (Text -> f Text) -> DescribeFraudster -> f DescribeFraudster
describeFraudster_domainId = (DescribeFraudster -> Text)
-> (DescribeFraudster -> Text -> DescribeFraudster)
-> Lens DescribeFraudster DescribeFraudster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFraudster' {Text
domainId :: Text
$sel:domainId:DescribeFraudster' :: DescribeFraudster -> Text
domainId} -> Text
domainId) (\s :: DescribeFraudster
s@DescribeFraudster' {} Text
a -> DescribeFraudster
s {$sel:domainId:DescribeFraudster' :: Text
domainId = Text
a} :: DescribeFraudster)

-- | The identifier of the fraudster you are describing.
describeFraudster_fraudsterId :: Lens.Lens' DescribeFraudster Prelude.Text
describeFraudster_fraudsterId :: (Text -> f Text) -> DescribeFraudster -> f DescribeFraudster
describeFraudster_fraudsterId = (DescribeFraudster -> Sensitive Text)
-> (DescribeFraudster -> Sensitive Text -> DescribeFraudster)
-> Lens
     DescribeFraudster
     DescribeFraudster
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFraudster' {Sensitive Text
fraudsterId :: Sensitive Text
$sel:fraudsterId:DescribeFraudster' :: DescribeFraudster -> Sensitive Text
fraudsterId} -> Sensitive Text
fraudsterId) (\s :: DescribeFraudster
s@DescribeFraudster' {} Sensitive Text
a -> DescribeFraudster
s {$sel:fraudsterId:DescribeFraudster' :: Sensitive Text
fraudsterId = Sensitive Text
a} :: DescribeFraudster) ((Sensitive Text -> f (Sensitive Text))
 -> DescribeFraudster -> f DescribeFraudster)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> DescribeFraudster
-> f DescribeFraudster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.AWSRequest DescribeFraudster where
  type
    AWSResponse DescribeFraudster =
      DescribeFraudsterResponse
  request :: DescribeFraudster -> Request DescribeFraudster
request = Service -> DescribeFraudster -> Request DescribeFraudster
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeFraudster
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeFraudster)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeFraudster))
-> Logger
-> Service
-> Proxy DescribeFraudster
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeFraudster)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Fraudster -> Int -> DescribeFraudsterResponse
DescribeFraudsterResponse'
            (Maybe Fraudster -> Int -> DescribeFraudsterResponse)
-> Either String (Maybe Fraudster)
-> Either String (Int -> DescribeFraudsterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Fraudster)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Fraudster")
            Either String (Int -> DescribeFraudsterResponse)
-> Either String Int -> Either String DescribeFraudsterResponse
forall (f :: * -> *) a b. Applicative f => 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 DescribeFraudster

instance Prelude.NFData DescribeFraudster

instance Core.ToHeaders DescribeFraudster where
  toHeaders :: DescribeFraudster -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeFraudster -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"VoiceID.DescribeFraudster" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeFraudster where
  toJSON :: DescribeFraudster -> Value
toJSON DescribeFraudster' {Text
Sensitive Text
fraudsterId :: Sensitive Text
domainId :: Text
$sel:fraudsterId:DescribeFraudster' :: DescribeFraudster -> Sensitive Text
$sel:domainId:DescribeFraudster' :: DescribeFraudster -> 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
"DomainId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FraudsterId" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
fraudsterId)
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeFraudsterResponse' 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:
--
-- 'fraudster', 'describeFraudsterResponse_fraudster' - Information about the specified fraudster.
--
-- 'httpStatus', 'describeFraudsterResponse_httpStatus' - The response's http status code.
newDescribeFraudsterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeFraudsterResponse
newDescribeFraudsterResponse :: Int -> DescribeFraudsterResponse
newDescribeFraudsterResponse Int
pHttpStatus_ =
  DescribeFraudsterResponse' :: Maybe Fraudster -> Int -> DescribeFraudsterResponse
DescribeFraudsterResponse'
    { $sel:fraudster:DescribeFraudsterResponse' :: Maybe Fraudster
fraudster =
        Maybe Fraudster
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeFraudsterResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the specified fraudster.
describeFraudsterResponse_fraudster :: Lens.Lens' DescribeFraudsterResponse (Prelude.Maybe Fraudster)
describeFraudsterResponse_fraudster :: (Maybe Fraudster -> f (Maybe Fraudster))
-> DescribeFraudsterResponse -> f DescribeFraudsterResponse
describeFraudsterResponse_fraudster = (DescribeFraudsterResponse -> Maybe Fraudster)
-> (DescribeFraudsterResponse
    -> Maybe Fraudster -> DescribeFraudsterResponse)
-> Lens
     DescribeFraudsterResponse
     DescribeFraudsterResponse
     (Maybe Fraudster)
     (Maybe Fraudster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFraudsterResponse' {Maybe Fraudster
fraudster :: Maybe Fraudster
$sel:fraudster:DescribeFraudsterResponse' :: DescribeFraudsterResponse -> Maybe Fraudster
fraudster} -> Maybe Fraudster
fraudster) (\s :: DescribeFraudsterResponse
s@DescribeFraudsterResponse' {} Maybe Fraudster
a -> DescribeFraudsterResponse
s {$sel:fraudster:DescribeFraudsterResponse' :: Maybe Fraudster
fraudster = Maybe Fraudster
a} :: DescribeFraudsterResponse)

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

instance Prelude.NFData DescribeFraudsterResponse