{-# 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.Rekognition.DetectCustomLabels
(
DetectCustomLabels (..),
newDetectCustomLabels,
detectCustomLabels_minConfidence,
detectCustomLabels_maxResults,
detectCustomLabels_projectVersionArn,
detectCustomLabels_image,
DetectCustomLabelsResponse (..),
newDetectCustomLabelsResponse,
detectCustomLabelsResponse_customLabels,
detectCustomLabelsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DetectCustomLabels = DetectCustomLabels'
{
DetectCustomLabels -> Maybe Double
minConfidence :: Prelude.Maybe Prelude.Double,
DetectCustomLabels -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
DetectCustomLabels -> Text
projectVersionArn :: Prelude.Text,
DetectCustomLabels -> Image
image :: Image
}
deriving (DetectCustomLabels -> DetectCustomLabels -> Bool
(DetectCustomLabels -> DetectCustomLabels -> Bool)
-> (DetectCustomLabels -> DetectCustomLabels -> Bool)
-> Eq DetectCustomLabels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectCustomLabels -> DetectCustomLabels -> Bool
$c/= :: DetectCustomLabels -> DetectCustomLabels -> Bool
== :: DetectCustomLabels -> DetectCustomLabels -> Bool
$c== :: DetectCustomLabels -> DetectCustomLabels -> Bool
Prelude.Eq, ReadPrec [DetectCustomLabels]
ReadPrec DetectCustomLabels
Int -> ReadS DetectCustomLabels
ReadS [DetectCustomLabels]
(Int -> ReadS DetectCustomLabels)
-> ReadS [DetectCustomLabels]
-> ReadPrec DetectCustomLabels
-> ReadPrec [DetectCustomLabels]
-> Read DetectCustomLabels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectCustomLabels]
$creadListPrec :: ReadPrec [DetectCustomLabels]
readPrec :: ReadPrec DetectCustomLabels
$creadPrec :: ReadPrec DetectCustomLabels
readList :: ReadS [DetectCustomLabels]
$creadList :: ReadS [DetectCustomLabels]
readsPrec :: Int -> ReadS DetectCustomLabels
$creadsPrec :: Int -> ReadS DetectCustomLabels
Prelude.Read, Int -> DetectCustomLabels -> ShowS
[DetectCustomLabels] -> ShowS
DetectCustomLabels -> String
(Int -> DetectCustomLabels -> ShowS)
-> (DetectCustomLabels -> String)
-> ([DetectCustomLabels] -> ShowS)
-> Show DetectCustomLabels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectCustomLabels] -> ShowS
$cshowList :: [DetectCustomLabels] -> ShowS
show :: DetectCustomLabels -> String
$cshow :: DetectCustomLabels -> String
showsPrec :: Int -> DetectCustomLabels -> ShowS
$cshowsPrec :: Int -> DetectCustomLabels -> ShowS
Prelude.Show, (forall x. DetectCustomLabels -> Rep DetectCustomLabels x)
-> (forall x. Rep DetectCustomLabels x -> DetectCustomLabels)
-> Generic DetectCustomLabels
forall x. Rep DetectCustomLabels x -> DetectCustomLabels
forall x. DetectCustomLabels -> Rep DetectCustomLabels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectCustomLabels x -> DetectCustomLabels
$cfrom :: forall x. DetectCustomLabels -> Rep DetectCustomLabels x
Prelude.Generic)
newDetectCustomLabels ::
Prelude.Text ->
Image ->
DetectCustomLabels
newDetectCustomLabels :: Text -> Image -> DetectCustomLabels
newDetectCustomLabels Text
pProjectVersionArn_ Image
pImage_ =
DetectCustomLabels' :: Maybe Double
-> Maybe Natural -> Text -> Image -> DetectCustomLabels
DetectCustomLabels'
{ $sel:minConfidence:DetectCustomLabels' :: Maybe Double
minConfidence =
Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:DetectCustomLabels' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:projectVersionArn:DetectCustomLabels' :: Text
projectVersionArn = Text
pProjectVersionArn_,
$sel:image:DetectCustomLabels' :: Image
image = Image
pImage_
}
detectCustomLabels_minConfidence :: Lens.Lens' DetectCustomLabels (Prelude.Maybe Prelude.Double)
detectCustomLabels_minConfidence :: (Maybe Double -> f (Maybe Double))
-> DetectCustomLabels -> f DetectCustomLabels
detectCustomLabels_minConfidence = (DetectCustomLabels -> Maybe Double)
-> (DetectCustomLabels -> Maybe Double -> DetectCustomLabels)
-> Lens
DetectCustomLabels DetectCustomLabels (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabels' {Maybe Double
minConfidence :: Maybe Double
$sel:minConfidence:DetectCustomLabels' :: DetectCustomLabels -> Maybe Double
minConfidence} -> Maybe Double
minConfidence) (\s :: DetectCustomLabels
s@DetectCustomLabels' {} Maybe Double
a -> DetectCustomLabels
s {$sel:minConfidence:DetectCustomLabels' :: Maybe Double
minConfidence = Maybe Double
a} :: DetectCustomLabels)
detectCustomLabels_maxResults :: Lens.Lens' DetectCustomLabels (Prelude.Maybe Prelude.Natural)
detectCustomLabels_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DetectCustomLabels -> f DetectCustomLabels
detectCustomLabels_maxResults = (DetectCustomLabels -> Maybe Natural)
-> (DetectCustomLabels -> Maybe Natural -> DetectCustomLabels)
-> Lens
DetectCustomLabels
DetectCustomLabels
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabels' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DetectCustomLabels' :: DetectCustomLabels -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DetectCustomLabels
s@DetectCustomLabels' {} Maybe Natural
a -> DetectCustomLabels
s {$sel:maxResults:DetectCustomLabels' :: Maybe Natural
maxResults = Maybe Natural
a} :: DetectCustomLabels)
detectCustomLabels_projectVersionArn :: Lens.Lens' DetectCustomLabels Prelude.Text
detectCustomLabels_projectVersionArn :: (Text -> f Text) -> DetectCustomLabels -> f DetectCustomLabels
detectCustomLabels_projectVersionArn = (DetectCustomLabels -> Text)
-> (DetectCustomLabels -> Text -> DetectCustomLabels)
-> Lens DetectCustomLabels DetectCustomLabels Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabels' {Text
projectVersionArn :: Text
$sel:projectVersionArn:DetectCustomLabels' :: DetectCustomLabels -> Text
projectVersionArn} -> Text
projectVersionArn) (\s :: DetectCustomLabels
s@DetectCustomLabels' {} Text
a -> DetectCustomLabels
s {$sel:projectVersionArn:DetectCustomLabels' :: Text
projectVersionArn = Text
a} :: DetectCustomLabels)
detectCustomLabels_image :: Lens.Lens' DetectCustomLabels Image
detectCustomLabels_image :: (Image -> f Image) -> DetectCustomLabels -> f DetectCustomLabels
detectCustomLabels_image = (DetectCustomLabels -> Image)
-> (DetectCustomLabels -> Image -> DetectCustomLabels)
-> Lens DetectCustomLabels DetectCustomLabels Image Image
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabels' {Image
image :: Image
$sel:image:DetectCustomLabels' :: DetectCustomLabels -> Image
image} -> Image
image) (\s :: DetectCustomLabels
s@DetectCustomLabels' {} Image
a -> DetectCustomLabels
s {$sel:image:DetectCustomLabels' :: Image
image = Image
a} :: DetectCustomLabels)
instance Core.AWSRequest DetectCustomLabels where
type
AWSResponse DetectCustomLabels =
DetectCustomLabelsResponse
request :: DetectCustomLabels -> Request DetectCustomLabels
request = Service -> DetectCustomLabels -> Request DetectCustomLabels
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DetectCustomLabels
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DetectCustomLabels)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DetectCustomLabels))
-> Logger
-> Service
-> Proxy DetectCustomLabels
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DetectCustomLabels)))
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 [CustomLabel] -> Int -> DetectCustomLabelsResponse
DetectCustomLabelsResponse'
(Maybe [CustomLabel] -> Int -> DetectCustomLabelsResponse)
-> Either String (Maybe [CustomLabel])
-> Either String (Int -> DetectCustomLabelsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [CustomLabel]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CustomLabels" Either String (Maybe (Maybe [CustomLabel]))
-> Maybe [CustomLabel] -> Either String (Maybe [CustomLabel])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [CustomLabel]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DetectCustomLabelsResponse)
-> Either String Int -> Either String DetectCustomLabelsResponse
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 DetectCustomLabels
instance Prelude.NFData DetectCustomLabels
instance Core.ToHeaders DetectCustomLabels where
toHeaders :: DetectCustomLabels -> ResponseHeaders
toHeaders =
ResponseHeaders -> DetectCustomLabels -> 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
"RekognitionService.DetectCustomLabels" ::
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 DetectCustomLabels where
toJSON :: DetectCustomLabels -> Value
toJSON DetectCustomLabels' {Maybe Double
Maybe Natural
Text
Image
image :: Image
projectVersionArn :: Text
maxResults :: Maybe Natural
minConfidence :: Maybe Double
$sel:image:DetectCustomLabels' :: DetectCustomLabels -> Image
$sel:projectVersionArn:DetectCustomLabels' :: DetectCustomLabels -> Text
$sel:maxResults:DetectCustomLabels' :: DetectCustomLabels -> Maybe Natural
$sel:minConfidence:DetectCustomLabels' :: DetectCustomLabels -> Maybe Double
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MinConfidence" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minConfidence,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ProjectVersionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
projectVersionArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Image" Text -> Image -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Image
image)
]
)
instance Core.ToPath DetectCustomLabels where
toPath :: DetectCustomLabels -> ByteString
toPath = ByteString -> DetectCustomLabels -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DetectCustomLabels where
toQuery :: DetectCustomLabels -> QueryString
toQuery = QueryString -> DetectCustomLabels -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DetectCustomLabelsResponse = DetectCustomLabelsResponse'
{
DetectCustomLabelsResponse -> Maybe [CustomLabel]
customLabels :: Prelude.Maybe [CustomLabel],
DetectCustomLabelsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
(DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool)
-> (DetectCustomLabelsResponse
-> DetectCustomLabelsResponse -> Bool)
-> Eq DetectCustomLabelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
$c/= :: DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
== :: DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
$c== :: DetectCustomLabelsResponse -> DetectCustomLabelsResponse -> Bool
Prelude.Eq, ReadPrec [DetectCustomLabelsResponse]
ReadPrec DetectCustomLabelsResponse
Int -> ReadS DetectCustomLabelsResponse
ReadS [DetectCustomLabelsResponse]
(Int -> ReadS DetectCustomLabelsResponse)
-> ReadS [DetectCustomLabelsResponse]
-> ReadPrec DetectCustomLabelsResponse
-> ReadPrec [DetectCustomLabelsResponse]
-> Read DetectCustomLabelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectCustomLabelsResponse]
$creadListPrec :: ReadPrec [DetectCustomLabelsResponse]
readPrec :: ReadPrec DetectCustomLabelsResponse
$creadPrec :: ReadPrec DetectCustomLabelsResponse
readList :: ReadS [DetectCustomLabelsResponse]
$creadList :: ReadS [DetectCustomLabelsResponse]
readsPrec :: Int -> ReadS DetectCustomLabelsResponse
$creadsPrec :: Int -> ReadS DetectCustomLabelsResponse
Prelude.Read, Int -> DetectCustomLabelsResponse -> ShowS
[DetectCustomLabelsResponse] -> ShowS
DetectCustomLabelsResponse -> String
(Int -> DetectCustomLabelsResponse -> ShowS)
-> (DetectCustomLabelsResponse -> String)
-> ([DetectCustomLabelsResponse] -> ShowS)
-> Show DetectCustomLabelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectCustomLabelsResponse] -> ShowS
$cshowList :: [DetectCustomLabelsResponse] -> ShowS
show :: DetectCustomLabelsResponse -> String
$cshow :: DetectCustomLabelsResponse -> String
showsPrec :: Int -> DetectCustomLabelsResponse -> ShowS
$cshowsPrec :: Int -> DetectCustomLabelsResponse -> ShowS
Prelude.Show, (forall x.
DetectCustomLabelsResponse -> Rep DetectCustomLabelsResponse x)
-> (forall x.
Rep DetectCustomLabelsResponse x -> DetectCustomLabelsResponse)
-> Generic DetectCustomLabelsResponse
forall x.
Rep DetectCustomLabelsResponse x -> DetectCustomLabelsResponse
forall x.
DetectCustomLabelsResponse -> Rep DetectCustomLabelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DetectCustomLabelsResponse x -> DetectCustomLabelsResponse
$cfrom :: forall x.
DetectCustomLabelsResponse -> Rep DetectCustomLabelsResponse x
Prelude.Generic)
newDetectCustomLabelsResponse ::
Prelude.Int ->
DetectCustomLabelsResponse
newDetectCustomLabelsResponse :: Int -> DetectCustomLabelsResponse
newDetectCustomLabelsResponse Int
pHttpStatus_ =
DetectCustomLabelsResponse' :: Maybe [CustomLabel] -> Int -> DetectCustomLabelsResponse
DetectCustomLabelsResponse'
{ $sel:customLabels:DetectCustomLabelsResponse' :: Maybe [CustomLabel]
customLabels =
Maybe [CustomLabel]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DetectCustomLabelsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
detectCustomLabelsResponse_customLabels :: Lens.Lens' DetectCustomLabelsResponse (Prelude.Maybe [CustomLabel])
detectCustomLabelsResponse_customLabels :: (Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
-> DetectCustomLabelsResponse -> f DetectCustomLabelsResponse
detectCustomLabelsResponse_customLabels = (DetectCustomLabelsResponse -> Maybe [CustomLabel])
-> (DetectCustomLabelsResponse
-> Maybe [CustomLabel] -> DetectCustomLabelsResponse)
-> Lens
DetectCustomLabelsResponse
DetectCustomLabelsResponse
(Maybe [CustomLabel])
(Maybe [CustomLabel])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabelsResponse' {Maybe [CustomLabel]
customLabels :: Maybe [CustomLabel]
$sel:customLabels:DetectCustomLabelsResponse' :: DetectCustomLabelsResponse -> Maybe [CustomLabel]
customLabels} -> Maybe [CustomLabel]
customLabels) (\s :: DetectCustomLabelsResponse
s@DetectCustomLabelsResponse' {} Maybe [CustomLabel]
a -> DetectCustomLabelsResponse
s {$sel:customLabels:DetectCustomLabelsResponse' :: Maybe [CustomLabel]
customLabels = Maybe [CustomLabel]
a} :: DetectCustomLabelsResponse) ((Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
-> DetectCustomLabelsResponse -> f DetectCustomLabelsResponse)
-> ((Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
-> Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
-> (Maybe [CustomLabel] -> f (Maybe [CustomLabel]))
-> DetectCustomLabelsResponse
-> f DetectCustomLabelsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CustomLabel] [CustomLabel] [CustomLabel] [CustomLabel]
-> Iso
(Maybe [CustomLabel])
(Maybe [CustomLabel])
(Maybe [CustomLabel])
(Maybe [CustomLabel])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [CustomLabel] [CustomLabel] [CustomLabel] [CustomLabel]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
detectCustomLabelsResponse_httpStatus :: Lens.Lens' DetectCustomLabelsResponse Prelude.Int
detectCustomLabelsResponse_httpStatus :: (Int -> f Int)
-> DetectCustomLabelsResponse -> f DetectCustomLabelsResponse
detectCustomLabelsResponse_httpStatus = (DetectCustomLabelsResponse -> Int)
-> (DetectCustomLabelsResponse
-> Int -> DetectCustomLabelsResponse)
-> Lens
DetectCustomLabelsResponse DetectCustomLabelsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectCustomLabelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetectCustomLabelsResponse' :: DetectCustomLabelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetectCustomLabelsResponse
s@DetectCustomLabelsResponse' {} Int
a -> DetectCustomLabelsResponse
s {$sel:httpStatus:DetectCustomLabelsResponse' :: Int
httpStatus = Int
a} :: DetectCustomLabelsResponse)
instance Prelude.NFData DetectCustomLabelsResponse