{-# 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.SageMakerA2IRuntime.StartHumanLoop
(
StartHumanLoop (..),
newStartHumanLoop,
startHumanLoop_dataAttributes,
startHumanLoop_humanLoopName,
startHumanLoop_flowDefinitionArn,
startHumanLoop_humanLoopInput,
StartHumanLoopResponse (..),
newStartHumanLoopResponse,
startHumanLoopResponse_humanLoopArn,
startHumanLoopResponse_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.SageMakerA2IRuntime.Types
data StartHumanLoop = StartHumanLoop'
{
StartHumanLoop -> Maybe HumanLoopDataAttributes
dataAttributes :: Prelude.Maybe HumanLoopDataAttributes,
StartHumanLoop -> Text
humanLoopName :: Prelude.Text,
StartHumanLoop -> Text
flowDefinitionArn :: Prelude.Text,
StartHumanLoop -> HumanLoopInput
humanLoopInput :: HumanLoopInput
}
deriving (StartHumanLoop -> StartHumanLoop -> Bool
(StartHumanLoop -> StartHumanLoop -> Bool)
-> (StartHumanLoop -> StartHumanLoop -> Bool) -> Eq StartHumanLoop
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartHumanLoop -> StartHumanLoop -> Bool
$c/= :: StartHumanLoop -> StartHumanLoop -> Bool
== :: StartHumanLoop -> StartHumanLoop -> Bool
$c== :: StartHumanLoop -> StartHumanLoop -> Bool
Prelude.Eq, ReadPrec [StartHumanLoop]
ReadPrec StartHumanLoop
Int -> ReadS StartHumanLoop
ReadS [StartHumanLoop]
(Int -> ReadS StartHumanLoop)
-> ReadS [StartHumanLoop]
-> ReadPrec StartHumanLoop
-> ReadPrec [StartHumanLoop]
-> Read StartHumanLoop
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartHumanLoop]
$creadListPrec :: ReadPrec [StartHumanLoop]
readPrec :: ReadPrec StartHumanLoop
$creadPrec :: ReadPrec StartHumanLoop
readList :: ReadS [StartHumanLoop]
$creadList :: ReadS [StartHumanLoop]
readsPrec :: Int -> ReadS StartHumanLoop
$creadsPrec :: Int -> ReadS StartHumanLoop
Prelude.Read, Int -> StartHumanLoop -> ShowS
[StartHumanLoop] -> ShowS
StartHumanLoop -> String
(Int -> StartHumanLoop -> ShowS)
-> (StartHumanLoop -> String)
-> ([StartHumanLoop] -> ShowS)
-> Show StartHumanLoop
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartHumanLoop] -> ShowS
$cshowList :: [StartHumanLoop] -> ShowS
show :: StartHumanLoop -> String
$cshow :: StartHumanLoop -> String
showsPrec :: Int -> StartHumanLoop -> ShowS
$cshowsPrec :: Int -> StartHumanLoop -> ShowS
Prelude.Show, (forall x. StartHumanLoop -> Rep StartHumanLoop x)
-> (forall x. Rep StartHumanLoop x -> StartHumanLoop)
-> Generic StartHumanLoop
forall x. Rep StartHumanLoop x -> StartHumanLoop
forall x. StartHumanLoop -> Rep StartHumanLoop x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartHumanLoop x -> StartHumanLoop
$cfrom :: forall x. StartHumanLoop -> Rep StartHumanLoop x
Prelude.Generic)
newStartHumanLoop ::
Prelude.Text ->
Prelude.Text ->
HumanLoopInput ->
StartHumanLoop
newStartHumanLoop :: Text -> Text -> HumanLoopInput -> StartHumanLoop
newStartHumanLoop
Text
pHumanLoopName_
Text
pFlowDefinitionArn_
HumanLoopInput
pHumanLoopInput_ =
StartHumanLoop' :: Maybe HumanLoopDataAttributes
-> Text -> Text -> HumanLoopInput -> StartHumanLoop
StartHumanLoop'
{ $sel:dataAttributes:StartHumanLoop' :: Maybe HumanLoopDataAttributes
dataAttributes = Maybe HumanLoopDataAttributes
forall a. Maybe a
Prelude.Nothing,
$sel:humanLoopName:StartHumanLoop' :: Text
humanLoopName = Text
pHumanLoopName_,
$sel:flowDefinitionArn:StartHumanLoop' :: Text
flowDefinitionArn = Text
pFlowDefinitionArn_,
$sel:humanLoopInput:StartHumanLoop' :: HumanLoopInput
humanLoopInput = HumanLoopInput
pHumanLoopInput_
}
startHumanLoop_dataAttributes :: Lens.Lens' StartHumanLoop (Prelude.Maybe HumanLoopDataAttributes)
startHumanLoop_dataAttributes :: (Maybe HumanLoopDataAttributes
-> f (Maybe HumanLoopDataAttributes))
-> StartHumanLoop -> f StartHumanLoop
startHumanLoop_dataAttributes = (StartHumanLoop -> Maybe HumanLoopDataAttributes)
-> (StartHumanLoop
-> Maybe HumanLoopDataAttributes -> StartHumanLoop)
-> Lens
StartHumanLoop
StartHumanLoop
(Maybe HumanLoopDataAttributes)
(Maybe HumanLoopDataAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartHumanLoop' {Maybe HumanLoopDataAttributes
dataAttributes :: Maybe HumanLoopDataAttributes
$sel:dataAttributes:StartHumanLoop' :: StartHumanLoop -> Maybe HumanLoopDataAttributes
dataAttributes} -> Maybe HumanLoopDataAttributes
dataAttributes) (\s :: StartHumanLoop
s@StartHumanLoop' {} Maybe HumanLoopDataAttributes
a -> StartHumanLoop
s {$sel:dataAttributes:StartHumanLoop' :: Maybe HumanLoopDataAttributes
dataAttributes = Maybe HumanLoopDataAttributes
a} :: StartHumanLoop)
startHumanLoop_humanLoopName :: Lens.Lens' StartHumanLoop Prelude.Text
startHumanLoop_humanLoopName :: (Text -> f Text) -> StartHumanLoop -> f StartHumanLoop
startHumanLoop_humanLoopName = (StartHumanLoop -> Text)
-> (StartHumanLoop -> Text -> StartHumanLoop)
-> Lens StartHumanLoop StartHumanLoop Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartHumanLoop' {Text
humanLoopName :: Text
$sel:humanLoopName:StartHumanLoop' :: StartHumanLoop -> Text
humanLoopName} -> Text
humanLoopName) (\s :: StartHumanLoop
s@StartHumanLoop' {} Text
a -> StartHumanLoop
s {$sel:humanLoopName:StartHumanLoop' :: Text
humanLoopName = Text
a} :: StartHumanLoop)
startHumanLoop_flowDefinitionArn :: Lens.Lens' StartHumanLoop Prelude.Text
startHumanLoop_flowDefinitionArn :: (Text -> f Text) -> StartHumanLoop -> f StartHumanLoop
startHumanLoop_flowDefinitionArn = (StartHumanLoop -> Text)
-> (StartHumanLoop -> Text -> StartHumanLoop)
-> Lens StartHumanLoop StartHumanLoop Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartHumanLoop' {Text
flowDefinitionArn :: Text
$sel:flowDefinitionArn:StartHumanLoop' :: StartHumanLoop -> Text
flowDefinitionArn} -> Text
flowDefinitionArn) (\s :: StartHumanLoop
s@StartHumanLoop' {} Text
a -> StartHumanLoop
s {$sel:flowDefinitionArn:StartHumanLoop' :: Text
flowDefinitionArn = Text
a} :: StartHumanLoop)
startHumanLoop_humanLoopInput :: Lens.Lens' StartHumanLoop HumanLoopInput
startHumanLoop_humanLoopInput :: (HumanLoopInput -> f HumanLoopInput)
-> StartHumanLoop -> f StartHumanLoop
startHumanLoop_humanLoopInput = (StartHumanLoop -> HumanLoopInput)
-> (StartHumanLoop -> HumanLoopInput -> StartHumanLoop)
-> Lens StartHumanLoop StartHumanLoop HumanLoopInput HumanLoopInput
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartHumanLoop' {HumanLoopInput
humanLoopInput :: HumanLoopInput
$sel:humanLoopInput:StartHumanLoop' :: StartHumanLoop -> HumanLoopInput
humanLoopInput} -> HumanLoopInput
humanLoopInput) (\s :: StartHumanLoop
s@StartHumanLoop' {} HumanLoopInput
a -> StartHumanLoop
s {$sel:humanLoopInput:StartHumanLoop' :: HumanLoopInput
humanLoopInput = HumanLoopInput
a} :: StartHumanLoop)
instance Core.AWSRequest StartHumanLoop where
type
AWSResponse StartHumanLoop =
StartHumanLoopResponse
request :: StartHumanLoop -> Request StartHumanLoop
request = Service -> StartHumanLoop -> Request StartHumanLoop
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartHumanLoop
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartHumanLoop)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartHumanLoop))
-> Logger
-> Service
-> Proxy StartHumanLoop
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartHumanLoop)))
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 -> StartHumanLoopResponse
StartHumanLoopResponse'
(Maybe Text -> Int -> StartHumanLoopResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartHumanLoopResponse)
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
"HumanLoopArn")
Either String (Int -> StartHumanLoopResponse)
-> Either String Int -> Either String StartHumanLoopResponse
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 StartHumanLoop
instance Prelude.NFData StartHumanLoop
instance Core.ToHeaders StartHumanLoop where
toHeaders :: StartHumanLoop -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartHumanLoop -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 StartHumanLoop where
toJSON :: StartHumanLoop -> Value
toJSON StartHumanLoop' {Maybe HumanLoopDataAttributes
Text
HumanLoopInput
humanLoopInput :: HumanLoopInput
flowDefinitionArn :: Text
humanLoopName :: Text
dataAttributes :: Maybe HumanLoopDataAttributes
$sel:humanLoopInput:StartHumanLoop' :: StartHumanLoop -> HumanLoopInput
$sel:flowDefinitionArn:StartHumanLoop' :: StartHumanLoop -> Text
$sel:humanLoopName:StartHumanLoop' :: StartHumanLoop -> Text
$sel:dataAttributes:StartHumanLoop' :: StartHumanLoop -> Maybe HumanLoopDataAttributes
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DataAttributes" Text -> HumanLoopDataAttributes -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HumanLoopDataAttributes -> Pair)
-> Maybe HumanLoopDataAttributes -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HumanLoopDataAttributes
dataAttributes,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HumanLoopName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
humanLoopName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"FlowDefinitionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
flowDefinitionArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"HumanLoopInput" Text -> HumanLoopInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HumanLoopInput
humanLoopInput)
]
)
instance Core.ToPath StartHumanLoop where
toPath :: StartHumanLoop -> ByteString
toPath = ByteString -> StartHumanLoop -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/human-loops"
instance Core.ToQuery StartHumanLoop where
toQuery :: StartHumanLoop -> QueryString
toQuery = QueryString -> StartHumanLoop -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartHumanLoopResponse = StartHumanLoopResponse'
{
StartHumanLoopResponse -> Maybe Text
humanLoopArn :: Prelude.Maybe Prelude.Text,
StartHumanLoopResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartHumanLoopResponse -> StartHumanLoopResponse -> Bool
(StartHumanLoopResponse -> StartHumanLoopResponse -> Bool)
-> (StartHumanLoopResponse -> StartHumanLoopResponse -> Bool)
-> Eq StartHumanLoopResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartHumanLoopResponse -> StartHumanLoopResponse -> Bool
$c/= :: StartHumanLoopResponse -> StartHumanLoopResponse -> Bool
== :: StartHumanLoopResponse -> StartHumanLoopResponse -> Bool
$c== :: StartHumanLoopResponse -> StartHumanLoopResponse -> Bool
Prelude.Eq, ReadPrec [StartHumanLoopResponse]
ReadPrec StartHumanLoopResponse
Int -> ReadS StartHumanLoopResponse
ReadS [StartHumanLoopResponse]
(Int -> ReadS StartHumanLoopResponse)
-> ReadS [StartHumanLoopResponse]
-> ReadPrec StartHumanLoopResponse
-> ReadPrec [StartHumanLoopResponse]
-> Read StartHumanLoopResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartHumanLoopResponse]
$creadListPrec :: ReadPrec [StartHumanLoopResponse]
readPrec :: ReadPrec StartHumanLoopResponse
$creadPrec :: ReadPrec StartHumanLoopResponse
readList :: ReadS [StartHumanLoopResponse]
$creadList :: ReadS [StartHumanLoopResponse]
readsPrec :: Int -> ReadS StartHumanLoopResponse
$creadsPrec :: Int -> ReadS StartHumanLoopResponse
Prelude.Read, Int -> StartHumanLoopResponse -> ShowS
[StartHumanLoopResponse] -> ShowS
StartHumanLoopResponse -> String
(Int -> StartHumanLoopResponse -> ShowS)
-> (StartHumanLoopResponse -> String)
-> ([StartHumanLoopResponse] -> ShowS)
-> Show StartHumanLoopResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartHumanLoopResponse] -> ShowS
$cshowList :: [StartHumanLoopResponse] -> ShowS
show :: StartHumanLoopResponse -> String
$cshow :: StartHumanLoopResponse -> String
showsPrec :: Int -> StartHumanLoopResponse -> ShowS
$cshowsPrec :: Int -> StartHumanLoopResponse -> ShowS
Prelude.Show, (forall x. StartHumanLoopResponse -> Rep StartHumanLoopResponse x)
-> (forall x.
Rep StartHumanLoopResponse x -> StartHumanLoopResponse)
-> Generic StartHumanLoopResponse
forall x. Rep StartHumanLoopResponse x -> StartHumanLoopResponse
forall x. StartHumanLoopResponse -> Rep StartHumanLoopResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartHumanLoopResponse x -> StartHumanLoopResponse
$cfrom :: forall x. StartHumanLoopResponse -> Rep StartHumanLoopResponse x
Prelude.Generic)
newStartHumanLoopResponse ::
Prelude.Int ->
StartHumanLoopResponse
newStartHumanLoopResponse :: Int -> StartHumanLoopResponse
newStartHumanLoopResponse Int
pHttpStatus_ =
StartHumanLoopResponse' :: Maybe Text -> Int -> StartHumanLoopResponse
StartHumanLoopResponse'
{ $sel:humanLoopArn:StartHumanLoopResponse' :: Maybe Text
humanLoopArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartHumanLoopResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startHumanLoopResponse_humanLoopArn :: Lens.Lens' StartHumanLoopResponse (Prelude.Maybe Prelude.Text)
startHumanLoopResponse_humanLoopArn :: (Maybe Text -> f (Maybe Text))
-> StartHumanLoopResponse -> f StartHumanLoopResponse
startHumanLoopResponse_humanLoopArn = (StartHumanLoopResponse -> Maybe Text)
-> (StartHumanLoopResponse -> Maybe Text -> StartHumanLoopResponse)
-> Lens
StartHumanLoopResponse
StartHumanLoopResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartHumanLoopResponse' {Maybe Text
humanLoopArn :: Maybe Text
$sel:humanLoopArn:StartHumanLoopResponse' :: StartHumanLoopResponse -> Maybe Text
humanLoopArn} -> Maybe Text
humanLoopArn) (\s :: StartHumanLoopResponse
s@StartHumanLoopResponse' {} Maybe Text
a -> StartHumanLoopResponse
s {$sel:humanLoopArn:StartHumanLoopResponse' :: Maybe Text
humanLoopArn = Maybe Text
a} :: StartHumanLoopResponse)
startHumanLoopResponse_httpStatus :: Lens.Lens' StartHumanLoopResponse Prelude.Int
startHumanLoopResponse_httpStatus :: (Int -> f Int)
-> StartHumanLoopResponse -> f StartHumanLoopResponse
startHumanLoopResponse_httpStatus = (StartHumanLoopResponse -> Int)
-> (StartHumanLoopResponse -> Int -> StartHumanLoopResponse)
-> Lens StartHumanLoopResponse StartHumanLoopResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartHumanLoopResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartHumanLoopResponse' :: StartHumanLoopResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartHumanLoopResponse
s@StartHumanLoopResponse' {} Int
a -> StartHumanLoopResponse
s {$sel:httpStatus:StartHumanLoopResponse' :: Int
httpStatus = Int
a} :: StartHumanLoopResponse)
instance Prelude.NFData StartHumanLoopResponse