{-# 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.StartProjectVersion
(
StartProjectVersion (..),
newStartProjectVersion,
startProjectVersion_projectVersionArn,
startProjectVersion_minInferenceUnits,
StartProjectVersionResponse (..),
newStartProjectVersionResponse,
startProjectVersionResponse_status,
startProjectVersionResponse_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 StartProjectVersion = StartProjectVersion'
{
StartProjectVersion -> Text
projectVersionArn :: Prelude.Text,
StartProjectVersion -> Natural
minInferenceUnits :: Prelude.Natural
}
deriving (StartProjectVersion -> StartProjectVersion -> Bool
(StartProjectVersion -> StartProjectVersion -> Bool)
-> (StartProjectVersion -> StartProjectVersion -> Bool)
-> Eq StartProjectVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartProjectVersion -> StartProjectVersion -> Bool
$c/= :: StartProjectVersion -> StartProjectVersion -> Bool
== :: StartProjectVersion -> StartProjectVersion -> Bool
$c== :: StartProjectVersion -> StartProjectVersion -> Bool
Prelude.Eq, ReadPrec [StartProjectVersion]
ReadPrec StartProjectVersion
Int -> ReadS StartProjectVersion
ReadS [StartProjectVersion]
(Int -> ReadS StartProjectVersion)
-> ReadS [StartProjectVersion]
-> ReadPrec StartProjectVersion
-> ReadPrec [StartProjectVersion]
-> Read StartProjectVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartProjectVersion]
$creadListPrec :: ReadPrec [StartProjectVersion]
readPrec :: ReadPrec StartProjectVersion
$creadPrec :: ReadPrec StartProjectVersion
readList :: ReadS [StartProjectVersion]
$creadList :: ReadS [StartProjectVersion]
readsPrec :: Int -> ReadS StartProjectVersion
$creadsPrec :: Int -> ReadS StartProjectVersion
Prelude.Read, Int -> StartProjectVersion -> ShowS
[StartProjectVersion] -> ShowS
StartProjectVersion -> String
(Int -> StartProjectVersion -> ShowS)
-> (StartProjectVersion -> String)
-> ([StartProjectVersion] -> ShowS)
-> Show StartProjectVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartProjectVersion] -> ShowS
$cshowList :: [StartProjectVersion] -> ShowS
show :: StartProjectVersion -> String
$cshow :: StartProjectVersion -> String
showsPrec :: Int -> StartProjectVersion -> ShowS
$cshowsPrec :: Int -> StartProjectVersion -> ShowS
Prelude.Show, (forall x. StartProjectVersion -> Rep StartProjectVersion x)
-> (forall x. Rep StartProjectVersion x -> StartProjectVersion)
-> Generic StartProjectVersion
forall x. Rep StartProjectVersion x -> StartProjectVersion
forall x. StartProjectVersion -> Rep StartProjectVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartProjectVersion x -> StartProjectVersion
$cfrom :: forall x. StartProjectVersion -> Rep StartProjectVersion x
Prelude.Generic)
newStartProjectVersion ::
Prelude.Text ->
Prelude.Natural ->
StartProjectVersion
newStartProjectVersion :: Text -> Natural -> StartProjectVersion
newStartProjectVersion
Text
pProjectVersionArn_
Natural
pMinInferenceUnits_ =
StartProjectVersion' :: Text -> Natural -> StartProjectVersion
StartProjectVersion'
{ $sel:projectVersionArn:StartProjectVersion' :: Text
projectVersionArn =
Text
pProjectVersionArn_,
$sel:minInferenceUnits:StartProjectVersion' :: Natural
minInferenceUnits = Natural
pMinInferenceUnits_
}
startProjectVersion_projectVersionArn :: Lens.Lens' StartProjectVersion Prelude.Text
startProjectVersion_projectVersionArn :: (Text -> f Text) -> StartProjectVersion -> f StartProjectVersion
startProjectVersion_projectVersionArn = (StartProjectVersion -> Text)
-> (StartProjectVersion -> Text -> StartProjectVersion)
-> Lens StartProjectVersion StartProjectVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartProjectVersion' {Text
projectVersionArn :: Text
$sel:projectVersionArn:StartProjectVersion' :: StartProjectVersion -> Text
projectVersionArn} -> Text
projectVersionArn) (\s :: StartProjectVersion
s@StartProjectVersion' {} Text
a -> StartProjectVersion
s {$sel:projectVersionArn:StartProjectVersion' :: Text
projectVersionArn = Text
a} :: StartProjectVersion)
startProjectVersion_minInferenceUnits :: Lens.Lens' StartProjectVersion Prelude.Natural
startProjectVersion_minInferenceUnits :: (Natural -> f Natural)
-> StartProjectVersion -> f StartProjectVersion
startProjectVersion_minInferenceUnits = (StartProjectVersion -> Natural)
-> (StartProjectVersion -> Natural -> StartProjectVersion)
-> Lens StartProjectVersion StartProjectVersion Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartProjectVersion' {Natural
minInferenceUnits :: Natural
$sel:minInferenceUnits:StartProjectVersion' :: StartProjectVersion -> Natural
minInferenceUnits} -> Natural
minInferenceUnits) (\s :: StartProjectVersion
s@StartProjectVersion' {} Natural
a -> StartProjectVersion
s {$sel:minInferenceUnits:StartProjectVersion' :: Natural
minInferenceUnits = Natural
a} :: StartProjectVersion)
instance Core.AWSRequest StartProjectVersion where
type
AWSResponse StartProjectVersion =
StartProjectVersionResponse
request :: StartProjectVersion -> Request StartProjectVersion
request = Service -> StartProjectVersion -> Request StartProjectVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartProjectVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartProjectVersion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartProjectVersion))
-> Logger
-> Service
-> Proxy StartProjectVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartProjectVersion)))
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 ProjectVersionStatus -> Int -> StartProjectVersionResponse
StartProjectVersionResponse'
(Maybe ProjectVersionStatus -> Int -> StartProjectVersionResponse)
-> Either String (Maybe ProjectVersionStatus)
-> Either String (Int -> StartProjectVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProjectVersionStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
Either String (Int -> StartProjectVersionResponse)
-> Either String Int -> Either String StartProjectVersionResponse
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 StartProjectVersion
instance Prelude.NFData StartProjectVersion
instance Core.ToHeaders StartProjectVersion where
toHeaders :: StartProjectVersion -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartProjectVersion -> 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.StartProjectVersion" ::
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 StartProjectVersion where
toJSON :: StartProjectVersion -> Value
toJSON StartProjectVersion' {Natural
Text
minInferenceUnits :: Natural
projectVersionArn :: Text
$sel:minInferenceUnits:StartProjectVersion' :: StartProjectVersion -> Natural
$sel:projectVersionArn:StartProjectVersion' :: StartProjectVersion -> 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
"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
"MinInferenceUnits" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
minInferenceUnits)
]
)
instance Core.ToPath StartProjectVersion where
toPath :: StartProjectVersion -> ByteString
toPath = ByteString -> StartProjectVersion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartProjectVersion where
toQuery :: StartProjectVersion -> QueryString
toQuery = QueryString -> StartProjectVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartProjectVersionResponse = StartProjectVersionResponse'
{
StartProjectVersionResponse -> Maybe ProjectVersionStatus
status :: Prelude.Maybe ProjectVersionStatus,
StartProjectVersionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartProjectVersionResponse -> StartProjectVersionResponse -> Bool
(StartProjectVersionResponse
-> StartProjectVersionResponse -> Bool)
-> (StartProjectVersionResponse
-> StartProjectVersionResponse -> Bool)
-> Eq StartProjectVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartProjectVersionResponse -> StartProjectVersionResponse -> Bool
$c/= :: StartProjectVersionResponse -> StartProjectVersionResponse -> Bool
== :: StartProjectVersionResponse -> StartProjectVersionResponse -> Bool
$c== :: StartProjectVersionResponse -> StartProjectVersionResponse -> Bool
Prelude.Eq, ReadPrec [StartProjectVersionResponse]
ReadPrec StartProjectVersionResponse
Int -> ReadS StartProjectVersionResponse
ReadS [StartProjectVersionResponse]
(Int -> ReadS StartProjectVersionResponse)
-> ReadS [StartProjectVersionResponse]
-> ReadPrec StartProjectVersionResponse
-> ReadPrec [StartProjectVersionResponse]
-> Read StartProjectVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartProjectVersionResponse]
$creadListPrec :: ReadPrec [StartProjectVersionResponse]
readPrec :: ReadPrec StartProjectVersionResponse
$creadPrec :: ReadPrec StartProjectVersionResponse
readList :: ReadS [StartProjectVersionResponse]
$creadList :: ReadS [StartProjectVersionResponse]
readsPrec :: Int -> ReadS StartProjectVersionResponse
$creadsPrec :: Int -> ReadS StartProjectVersionResponse
Prelude.Read, Int -> StartProjectVersionResponse -> ShowS
[StartProjectVersionResponse] -> ShowS
StartProjectVersionResponse -> String
(Int -> StartProjectVersionResponse -> ShowS)
-> (StartProjectVersionResponse -> String)
-> ([StartProjectVersionResponse] -> ShowS)
-> Show StartProjectVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartProjectVersionResponse] -> ShowS
$cshowList :: [StartProjectVersionResponse] -> ShowS
show :: StartProjectVersionResponse -> String
$cshow :: StartProjectVersionResponse -> String
showsPrec :: Int -> StartProjectVersionResponse -> ShowS
$cshowsPrec :: Int -> StartProjectVersionResponse -> ShowS
Prelude.Show, (forall x.
StartProjectVersionResponse -> Rep StartProjectVersionResponse x)
-> (forall x.
Rep StartProjectVersionResponse x -> StartProjectVersionResponse)
-> Generic StartProjectVersionResponse
forall x.
Rep StartProjectVersionResponse x -> StartProjectVersionResponse
forall x.
StartProjectVersionResponse -> Rep StartProjectVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartProjectVersionResponse x -> StartProjectVersionResponse
$cfrom :: forall x.
StartProjectVersionResponse -> Rep StartProjectVersionResponse x
Prelude.Generic)
newStartProjectVersionResponse ::
Prelude.Int ->
StartProjectVersionResponse
newStartProjectVersionResponse :: Int -> StartProjectVersionResponse
newStartProjectVersionResponse Int
pHttpStatus_ =
StartProjectVersionResponse' :: Maybe ProjectVersionStatus -> Int -> StartProjectVersionResponse
StartProjectVersionResponse'
{ $sel:status:StartProjectVersionResponse' :: Maybe ProjectVersionStatus
status =
Maybe ProjectVersionStatus
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartProjectVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startProjectVersionResponse_status :: Lens.Lens' StartProjectVersionResponse (Prelude.Maybe ProjectVersionStatus)
startProjectVersionResponse_status :: (Maybe ProjectVersionStatus -> f (Maybe ProjectVersionStatus))
-> StartProjectVersionResponse -> f StartProjectVersionResponse
startProjectVersionResponse_status = (StartProjectVersionResponse -> Maybe ProjectVersionStatus)
-> (StartProjectVersionResponse
-> Maybe ProjectVersionStatus -> StartProjectVersionResponse)
-> Lens
StartProjectVersionResponse
StartProjectVersionResponse
(Maybe ProjectVersionStatus)
(Maybe ProjectVersionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartProjectVersionResponse' {Maybe ProjectVersionStatus
status :: Maybe ProjectVersionStatus
$sel:status:StartProjectVersionResponse' :: StartProjectVersionResponse -> Maybe ProjectVersionStatus
status} -> Maybe ProjectVersionStatus
status) (\s :: StartProjectVersionResponse
s@StartProjectVersionResponse' {} Maybe ProjectVersionStatus
a -> StartProjectVersionResponse
s {$sel:status:StartProjectVersionResponse' :: Maybe ProjectVersionStatus
status = Maybe ProjectVersionStatus
a} :: StartProjectVersionResponse)
startProjectVersionResponse_httpStatus :: Lens.Lens' StartProjectVersionResponse Prelude.Int
startProjectVersionResponse_httpStatus :: (Int -> f Int)
-> StartProjectVersionResponse -> f StartProjectVersionResponse
startProjectVersionResponse_httpStatus = (StartProjectVersionResponse -> Int)
-> (StartProjectVersionResponse
-> Int -> StartProjectVersionResponse)
-> Lens
StartProjectVersionResponse StartProjectVersionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartProjectVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartProjectVersionResponse' :: StartProjectVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartProjectVersionResponse
s@StartProjectVersionResponse' {} Int
a -> StartProjectVersionResponse
s {$sel:httpStatus:StartProjectVersionResponse' :: Int
httpStatus = Int
a} :: StartProjectVersionResponse)
instance Prelude.NFData StartProjectVersionResponse