{-# 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 #-}
module Amazonka.ComprehendMedical.DetectPHI
(
DetectPHI (..),
newDetectPHI,
detectPHI_text,
DetectPHIResponse (..),
newDetectPHIResponse,
detectPHIResponse_paginationToken,
detectPHIResponse_httpStatus,
detectPHIResponse_entities,
detectPHIResponse_modelVersion,
)
where
import Amazonka.ComprehendMedical.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
data DetectPHI = DetectPHI'
{
DetectPHI -> Text
text :: Prelude.Text
}
deriving (DetectPHI -> DetectPHI -> Bool
(DetectPHI -> DetectPHI -> Bool)
-> (DetectPHI -> DetectPHI -> Bool) -> Eq DetectPHI
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectPHI -> DetectPHI -> Bool
$c/= :: DetectPHI -> DetectPHI -> Bool
== :: DetectPHI -> DetectPHI -> Bool
$c== :: DetectPHI -> DetectPHI -> Bool
Prelude.Eq, ReadPrec [DetectPHI]
ReadPrec DetectPHI
Int -> ReadS DetectPHI
ReadS [DetectPHI]
(Int -> ReadS DetectPHI)
-> ReadS [DetectPHI]
-> ReadPrec DetectPHI
-> ReadPrec [DetectPHI]
-> Read DetectPHI
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectPHI]
$creadListPrec :: ReadPrec [DetectPHI]
readPrec :: ReadPrec DetectPHI
$creadPrec :: ReadPrec DetectPHI
readList :: ReadS [DetectPHI]
$creadList :: ReadS [DetectPHI]
readsPrec :: Int -> ReadS DetectPHI
$creadsPrec :: Int -> ReadS DetectPHI
Prelude.Read, Int -> DetectPHI -> ShowS
[DetectPHI] -> ShowS
DetectPHI -> String
(Int -> DetectPHI -> ShowS)
-> (DetectPHI -> String)
-> ([DetectPHI] -> ShowS)
-> Show DetectPHI
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectPHI] -> ShowS
$cshowList :: [DetectPHI] -> ShowS
show :: DetectPHI -> String
$cshow :: DetectPHI -> String
showsPrec :: Int -> DetectPHI -> ShowS
$cshowsPrec :: Int -> DetectPHI -> ShowS
Prelude.Show, (forall x. DetectPHI -> Rep DetectPHI x)
-> (forall x. Rep DetectPHI x -> DetectPHI) -> Generic DetectPHI
forall x. Rep DetectPHI x -> DetectPHI
forall x. DetectPHI -> Rep DetectPHI x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectPHI x -> DetectPHI
$cfrom :: forall x. DetectPHI -> Rep DetectPHI x
Prelude.Generic)
newDetectPHI ::
Prelude.Text ->
DetectPHI
newDetectPHI :: Text -> DetectPHI
newDetectPHI Text
pText_ = DetectPHI' :: Text -> DetectPHI
DetectPHI' {$sel:text:DetectPHI' :: Text
text = Text
pText_}
detectPHI_text :: Lens.Lens' DetectPHI Prelude.Text
detectPHI_text :: (Text -> f Text) -> DetectPHI -> f DetectPHI
detectPHI_text = (DetectPHI -> Text)
-> (DetectPHI -> Text -> DetectPHI)
-> Lens DetectPHI DetectPHI Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectPHI' {Text
text :: Text
$sel:text:DetectPHI' :: DetectPHI -> Text
text} -> Text
text) (\s :: DetectPHI
s@DetectPHI' {} Text
a -> DetectPHI
s {$sel:text:DetectPHI' :: Text
text = Text
a} :: DetectPHI)
instance Core.AWSRequest DetectPHI where
type AWSResponse DetectPHI = DetectPHIResponse
request :: DetectPHI -> Request DetectPHI
request = Service -> DetectPHI -> Request DetectPHI
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DetectPHI
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetectPHI)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DetectPHI))
-> Logger
-> Service
-> Proxy DetectPHI
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetectPHI)))
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 Text -> Int -> [Entity] -> Text -> DetectPHIResponse
DetectPHIResponse'
(Maybe Text -> Int -> [Entity] -> Text -> DetectPHIResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Entity] -> Text -> DetectPHIResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PaginationToken")
Either String (Int -> [Entity] -> Text -> DetectPHIResponse)
-> Either String Int
-> Either String ([Entity] -> Text -> DetectPHIResponse)
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))
Either String ([Entity] -> Text -> DetectPHIResponse)
-> Either String [Entity]
-> Either String (Text -> DetectPHIResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Entity])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Entities" Either String (Maybe [Entity])
-> [Entity] -> Either String [Entity]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Entity]
forall a. Monoid a => a
Prelude.mempty)
Either String (Text -> DetectPHIResponse)
-> Either String Text -> Either String DetectPHIResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ModelVersion")
)
instance Prelude.Hashable DetectPHI
instance Prelude.NFData DetectPHI
instance Core.ToHeaders DetectPHI where
toHeaders :: DetectPHI -> ResponseHeaders
toHeaders =
ResponseHeaders -> DetectPHI -> 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
"ComprehendMedical_20181030.DetectPHI" ::
Prelude.ByteString
),
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 DetectPHI where
toJSON :: DetectPHI -> Value
toJSON DetectPHI' {Text
text :: Text
$sel:text:DetectPHI' :: DetectPHI -> 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
"Text" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
text)]
)
instance Core.ToPath DetectPHI where
toPath :: DetectPHI -> ByteString
toPath = ByteString -> DetectPHI -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DetectPHI where
toQuery :: DetectPHI -> QueryString
toQuery = QueryString -> DetectPHI -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DetectPHIResponse = DetectPHIResponse'
{
:: Prelude.Maybe Prelude.Text,
DetectPHIResponse -> Int
httpStatus :: Prelude.Int,
DetectPHIResponse -> [Entity]
entities :: [Entity],
DetectPHIResponse -> Text
modelVersion :: Prelude.Text
}
deriving (DetectPHIResponse -> DetectPHIResponse -> Bool
(DetectPHIResponse -> DetectPHIResponse -> Bool)
-> (DetectPHIResponse -> DetectPHIResponse -> Bool)
-> Eq DetectPHIResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectPHIResponse -> DetectPHIResponse -> Bool
$c/= :: DetectPHIResponse -> DetectPHIResponse -> Bool
== :: DetectPHIResponse -> DetectPHIResponse -> Bool
$c== :: DetectPHIResponse -> DetectPHIResponse -> Bool
Prelude.Eq, ReadPrec [DetectPHIResponse]
ReadPrec DetectPHIResponse
Int -> ReadS DetectPHIResponse
ReadS [DetectPHIResponse]
(Int -> ReadS DetectPHIResponse)
-> ReadS [DetectPHIResponse]
-> ReadPrec DetectPHIResponse
-> ReadPrec [DetectPHIResponse]
-> Read DetectPHIResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectPHIResponse]
$creadListPrec :: ReadPrec [DetectPHIResponse]
readPrec :: ReadPrec DetectPHIResponse
$creadPrec :: ReadPrec DetectPHIResponse
readList :: ReadS [DetectPHIResponse]
$creadList :: ReadS [DetectPHIResponse]
readsPrec :: Int -> ReadS DetectPHIResponse
$creadsPrec :: Int -> ReadS DetectPHIResponse
Prelude.Read, Int -> DetectPHIResponse -> ShowS
[DetectPHIResponse] -> ShowS
DetectPHIResponse -> String
(Int -> DetectPHIResponse -> ShowS)
-> (DetectPHIResponse -> String)
-> ([DetectPHIResponse] -> ShowS)
-> Show DetectPHIResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectPHIResponse] -> ShowS
$cshowList :: [DetectPHIResponse] -> ShowS
show :: DetectPHIResponse -> String
$cshow :: DetectPHIResponse -> String
showsPrec :: Int -> DetectPHIResponse -> ShowS
$cshowsPrec :: Int -> DetectPHIResponse -> ShowS
Prelude.Show, (forall x. DetectPHIResponse -> Rep DetectPHIResponse x)
-> (forall x. Rep DetectPHIResponse x -> DetectPHIResponse)
-> Generic DetectPHIResponse
forall x. Rep DetectPHIResponse x -> DetectPHIResponse
forall x. DetectPHIResponse -> Rep DetectPHIResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectPHIResponse x -> DetectPHIResponse
$cfrom :: forall x. DetectPHIResponse -> Rep DetectPHIResponse x
Prelude.Generic)
newDetectPHIResponse ::
Prelude.Int ->
Prelude.Text ->
DetectPHIResponse
newDetectPHIResponse :: Int -> Text -> DetectPHIResponse
newDetectPHIResponse Int
pHttpStatus_ Text
pModelVersion_ =
DetectPHIResponse' :: Maybe Text -> Int -> [Entity] -> Text -> DetectPHIResponse
DetectPHIResponse'
{ $sel:paginationToken:DetectPHIResponse' :: Maybe Text
paginationToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DetectPHIResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:entities:DetectPHIResponse' :: [Entity]
entities = [Entity]
forall a. Monoid a => a
Prelude.mempty,
$sel:modelVersion:DetectPHIResponse' :: Text
modelVersion = Text
pModelVersion_
}
detectPHIResponse_paginationToken :: Lens.Lens' DetectPHIResponse (Prelude.Maybe Prelude.Text)
= (DetectPHIResponse -> Maybe Text)
-> (DetectPHIResponse -> Maybe Text -> DetectPHIResponse)
-> Lens
DetectPHIResponse DetectPHIResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectPHIResponse' {Maybe Text
paginationToken :: Maybe Text
$sel:paginationToken:DetectPHIResponse' :: DetectPHIResponse -> Maybe Text
paginationToken} -> Maybe Text
paginationToken) (\s :: DetectPHIResponse
s@DetectPHIResponse' {} Maybe Text
a -> DetectPHIResponse
s {$sel:paginationToken:DetectPHIResponse' :: Maybe Text
paginationToken = Maybe Text
a} :: DetectPHIResponse)
detectPHIResponse_httpStatus :: Lens.Lens' DetectPHIResponse Prelude.Int
detectPHIResponse_httpStatus :: (Int -> f Int) -> DetectPHIResponse -> f DetectPHIResponse
detectPHIResponse_httpStatus = (DetectPHIResponse -> Int)
-> (DetectPHIResponse -> Int -> DetectPHIResponse)
-> Lens DetectPHIResponse DetectPHIResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectPHIResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetectPHIResponse' :: DetectPHIResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetectPHIResponse
s@DetectPHIResponse' {} Int
a -> DetectPHIResponse
s {$sel:httpStatus:DetectPHIResponse' :: Int
httpStatus = Int
a} :: DetectPHIResponse)
detectPHIResponse_entities :: Lens.Lens' DetectPHIResponse [Entity]
detectPHIResponse_entities :: ([Entity] -> f [Entity])
-> DetectPHIResponse -> f DetectPHIResponse
detectPHIResponse_entities = (DetectPHIResponse -> [Entity])
-> (DetectPHIResponse -> [Entity] -> DetectPHIResponse)
-> Lens DetectPHIResponse DetectPHIResponse [Entity] [Entity]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectPHIResponse' {[Entity]
entities :: [Entity]
$sel:entities:DetectPHIResponse' :: DetectPHIResponse -> [Entity]
entities} -> [Entity]
entities) (\s :: DetectPHIResponse
s@DetectPHIResponse' {} [Entity]
a -> DetectPHIResponse
s {$sel:entities:DetectPHIResponse' :: [Entity]
entities = [Entity]
a} :: DetectPHIResponse) (([Entity] -> f [Entity])
-> DetectPHIResponse -> f DetectPHIResponse)
-> (([Entity] -> f [Entity]) -> [Entity] -> f [Entity])
-> ([Entity] -> f [Entity])
-> DetectPHIResponse
-> f DetectPHIResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Entity] -> f [Entity]) -> [Entity] -> f [Entity]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
detectPHIResponse_modelVersion :: Lens.Lens' DetectPHIResponse Prelude.Text
detectPHIResponse_modelVersion :: (Text -> f Text) -> DetectPHIResponse -> f DetectPHIResponse
detectPHIResponse_modelVersion = (DetectPHIResponse -> Text)
-> (DetectPHIResponse -> Text -> DetectPHIResponse)
-> Lens DetectPHIResponse DetectPHIResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectPHIResponse' {Text
modelVersion :: Text
$sel:modelVersion:DetectPHIResponse' :: DetectPHIResponse -> Text
modelVersion} -> Text
modelVersion) (\s :: DetectPHIResponse
s@DetectPHIResponse' {} Text
a -> DetectPHIResponse
s {$sel:modelVersion:DetectPHIResponse' :: Text
modelVersion = Text
a} :: DetectPHIResponse)
instance Prelude.NFData DetectPHIResponse