{-# 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.MachineLearning.CreateEvaluation
(
CreateEvaluation (..),
newCreateEvaluation,
createEvaluation_evaluationName,
createEvaluation_evaluationId,
createEvaluation_mLModelId,
createEvaluation_evaluationDataSourceId,
CreateEvaluationResponse (..),
newCreateEvaluationResponse,
createEvaluationResponse_evaluationId,
createEvaluationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MachineLearning.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateEvaluation = CreateEvaluation'
{
CreateEvaluation -> Maybe Text
evaluationName :: Prelude.Maybe Prelude.Text,
CreateEvaluation -> Text
evaluationId :: Prelude.Text,
CreateEvaluation -> Text
mLModelId :: Prelude.Text,
CreateEvaluation -> Text
evaluationDataSourceId :: Prelude.Text
}
deriving (CreateEvaluation -> CreateEvaluation -> Bool
(CreateEvaluation -> CreateEvaluation -> Bool)
-> (CreateEvaluation -> CreateEvaluation -> Bool)
-> Eq CreateEvaluation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEvaluation -> CreateEvaluation -> Bool
$c/= :: CreateEvaluation -> CreateEvaluation -> Bool
== :: CreateEvaluation -> CreateEvaluation -> Bool
$c== :: CreateEvaluation -> CreateEvaluation -> Bool
Prelude.Eq, ReadPrec [CreateEvaluation]
ReadPrec CreateEvaluation
Int -> ReadS CreateEvaluation
ReadS [CreateEvaluation]
(Int -> ReadS CreateEvaluation)
-> ReadS [CreateEvaluation]
-> ReadPrec CreateEvaluation
-> ReadPrec [CreateEvaluation]
-> Read CreateEvaluation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEvaluation]
$creadListPrec :: ReadPrec [CreateEvaluation]
readPrec :: ReadPrec CreateEvaluation
$creadPrec :: ReadPrec CreateEvaluation
readList :: ReadS [CreateEvaluation]
$creadList :: ReadS [CreateEvaluation]
readsPrec :: Int -> ReadS CreateEvaluation
$creadsPrec :: Int -> ReadS CreateEvaluation
Prelude.Read, Int -> CreateEvaluation -> ShowS
[CreateEvaluation] -> ShowS
CreateEvaluation -> String
(Int -> CreateEvaluation -> ShowS)
-> (CreateEvaluation -> String)
-> ([CreateEvaluation] -> ShowS)
-> Show CreateEvaluation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEvaluation] -> ShowS
$cshowList :: [CreateEvaluation] -> ShowS
show :: CreateEvaluation -> String
$cshow :: CreateEvaluation -> String
showsPrec :: Int -> CreateEvaluation -> ShowS
$cshowsPrec :: Int -> CreateEvaluation -> ShowS
Prelude.Show, (forall x. CreateEvaluation -> Rep CreateEvaluation x)
-> (forall x. Rep CreateEvaluation x -> CreateEvaluation)
-> Generic CreateEvaluation
forall x. Rep CreateEvaluation x -> CreateEvaluation
forall x. CreateEvaluation -> Rep CreateEvaluation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateEvaluation x -> CreateEvaluation
$cfrom :: forall x. CreateEvaluation -> Rep CreateEvaluation x
Prelude.Generic)
newCreateEvaluation ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateEvaluation
newCreateEvaluation :: Text -> Text -> Text -> CreateEvaluation
newCreateEvaluation
Text
pEvaluationId_
Text
pMLModelId_
Text
pEvaluationDataSourceId_ =
CreateEvaluation' :: Maybe Text -> Text -> Text -> Text -> CreateEvaluation
CreateEvaluation'
{ $sel:evaluationName:CreateEvaluation' :: Maybe Text
evaluationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:evaluationId:CreateEvaluation' :: Text
evaluationId = Text
pEvaluationId_,
$sel:mLModelId:CreateEvaluation' :: Text
mLModelId = Text
pMLModelId_,
$sel:evaluationDataSourceId:CreateEvaluation' :: Text
evaluationDataSourceId = Text
pEvaluationDataSourceId_
}
createEvaluation_evaluationName :: Lens.Lens' CreateEvaluation (Prelude.Maybe Prelude.Text)
createEvaluation_evaluationName :: (Maybe Text -> f (Maybe Text))
-> CreateEvaluation -> f CreateEvaluation
createEvaluation_evaluationName = (CreateEvaluation -> Maybe Text)
-> (CreateEvaluation -> Maybe Text -> CreateEvaluation)
-> Lens CreateEvaluation CreateEvaluation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEvaluation' {Maybe Text
evaluationName :: Maybe Text
$sel:evaluationName:CreateEvaluation' :: CreateEvaluation -> Maybe Text
evaluationName} -> Maybe Text
evaluationName) (\s :: CreateEvaluation
s@CreateEvaluation' {} Maybe Text
a -> CreateEvaluation
s {$sel:evaluationName:CreateEvaluation' :: Maybe Text
evaluationName = Maybe Text
a} :: CreateEvaluation)
createEvaluation_evaluationId :: Lens.Lens' CreateEvaluation Prelude.Text
createEvaluation_evaluationId :: (Text -> f Text) -> CreateEvaluation -> f CreateEvaluation
createEvaluation_evaluationId = (CreateEvaluation -> Text)
-> (CreateEvaluation -> Text -> CreateEvaluation)
-> Lens CreateEvaluation CreateEvaluation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEvaluation' {Text
evaluationId :: Text
$sel:evaluationId:CreateEvaluation' :: CreateEvaluation -> Text
evaluationId} -> Text
evaluationId) (\s :: CreateEvaluation
s@CreateEvaluation' {} Text
a -> CreateEvaluation
s {$sel:evaluationId:CreateEvaluation' :: Text
evaluationId = Text
a} :: CreateEvaluation)
createEvaluation_mLModelId :: Lens.Lens' CreateEvaluation Prelude.Text
createEvaluation_mLModelId :: (Text -> f Text) -> CreateEvaluation -> f CreateEvaluation
createEvaluation_mLModelId = (CreateEvaluation -> Text)
-> (CreateEvaluation -> Text -> CreateEvaluation)
-> Lens CreateEvaluation CreateEvaluation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEvaluation' {Text
mLModelId :: Text
$sel:mLModelId:CreateEvaluation' :: CreateEvaluation -> Text
mLModelId} -> Text
mLModelId) (\s :: CreateEvaluation
s@CreateEvaluation' {} Text
a -> CreateEvaluation
s {$sel:mLModelId:CreateEvaluation' :: Text
mLModelId = Text
a} :: CreateEvaluation)
createEvaluation_evaluationDataSourceId :: Lens.Lens' CreateEvaluation Prelude.Text
createEvaluation_evaluationDataSourceId :: (Text -> f Text) -> CreateEvaluation -> f CreateEvaluation
createEvaluation_evaluationDataSourceId = (CreateEvaluation -> Text)
-> (CreateEvaluation -> Text -> CreateEvaluation)
-> Lens CreateEvaluation CreateEvaluation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEvaluation' {Text
evaluationDataSourceId :: Text
$sel:evaluationDataSourceId:CreateEvaluation' :: CreateEvaluation -> Text
evaluationDataSourceId} -> Text
evaluationDataSourceId) (\s :: CreateEvaluation
s@CreateEvaluation' {} Text
a -> CreateEvaluation
s {$sel:evaluationDataSourceId:CreateEvaluation' :: Text
evaluationDataSourceId = Text
a} :: CreateEvaluation)
instance Core.AWSRequest CreateEvaluation where
type
AWSResponse CreateEvaluation =
CreateEvaluationResponse
request :: CreateEvaluation -> Request CreateEvaluation
request = Service -> CreateEvaluation -> Request CreateEvaluation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateEvaluation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateEvaluation)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateEvaluation))
-> Logger
-> Service
-> Proxy CreateEvaluation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateEvaluation)))
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 -> CreateEvaluationResponse
CreateEvaluationResponse'
(Maybe Text -> Int -> CreateEvaluationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateEvaluationResponse)
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
"EvaluationId")
Either String (Int -> CreateEvaluationResponse)
-> Either String Int -> Either String CreateEvaluationResponse
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 CreateEvaluation
instance Prelude.NFData CreateEvaluation
instance Core.ToHeaders CreateEvaluation where
toHeaders :: CreateEvaluation -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateEvaluation -> 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
"AmazonML_20141212.CreateEvaluation" ::
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 CreateEvaluation where
toJSON :: CreateEvaluation -> Value
toJSON CreateEvaluation' {Maybe Text
Text
evaluationDataSourceId :: Text
mLModelId :: Text
evaluationId :: Text
evaluationName :: Maybe Text
$sel:evaluationDataSourceId:CreateEvaluation' :: CreateEvaluation -> Text
$sel:mLModelId:CreateEvaluation' :: CreateEvaluation -> Text
$sel:evaluationId:CreateEvaluation' :: CreateEvaluation -> Text
$sel:evaluationName:CreateEvaluation' :: CreateEvaluation -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EvaluationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
evaluationName,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EvaluationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
evaluationId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MLModelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
mLModelId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"EvaluationDataSourceId"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
evaluationDataSourceId
)
]
)
instance Core.ToPath CreateEvaluation where
toPath :: CreateEvaluation -> ByteString
toPath = ByteString -> CreateEvaluation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateEvaluation where
toQuery :: CreateEvaluation -> QueryString
toQuery = QueryString -> CreateEvaluation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateEvaluationResponse = CreateEvaluationResponse'
{
CreateEvaluationResponse -> Maybe Text
evaluationId :: Prelude.Maybe Prelude.Text,
CreateEvaluationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateEvaluationResponse -> CreateEvaluationResponse -> Bool
(CreateEvaluationResponse -> CreateEvaluationResponse -> Bool)
-> (CreateEvaluationResponse -> CreateEvaluationResponse -> Bool)
-> Eq CreateEvaluationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEvaluationResponse -> CreateEvaluationResponse -> Bool
$c/= :: CreateEvaluationResponse -> CreateEvaluationResponse -> Bool
== :: CreateEvaluationResponse -> CreateEvaluationResponse -> Bool
$c== :: CreateEvaluationResponse -> CreateEvaluationResponse -> Bool
Prelude.Eq, ReadPrec [CreateEvaluationResponse]
ReadPrec CreateEvaluationResponse
Int -> ReadS CreateEvaluationResponse
ReadS [CreateEvaluationResponse]
(Int -> ReadS CreateEvaluationResponse)
-> ReadS [CreateEvaluationResponse]
-> ReadPrec CreateEvaluationResponse
-> ReadPrec [CreateEvaluationResponse]
-> Read CreateEvaluationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEvaluationResponse]
$creadListPrec :: ReadPrec [CreateEvaluationResponse]
readPrec :: ReadPrec CreateEvaluationResponse
$creadPrec :: ReadPrec CreateEvaluationResponse
readList :: ReadS [CreateEvaluationResponse]
$creadList :: ReadS [CreateEvaluationResponse]
readsPrec :: Int -> ReadS CreateEvaluationResponse
$creadsPrec :: Int -> ReadS CreateEvaluationResponse
Prelude.Read, Int -> CreateEvaluationResponse -> ShowS
[CreateEvaluationResponse] -> ShowS
CreateEvaluationResponse -> String
(Int -> CreateEvaluationResponse -> ShowS)
-> (CreateEvaluationResponse -> String)
-> ([CreateEvaluationResponse] -> ShowS)
-> Show CreateEvaluationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEvaluationResponse] -> ShowS
$cshowList :: [CreateEvaluationResponse] -> ShowS
show :: CreateEvaluationResponse -> String
$cshow :: CreateEvaluationResponse -> String
showsPrec :: Int -> CreateEvaluationResponse -> ShowS
$cshowsPrec :: Int -> CreateEvaluationResponse -> ShowS
Prelude.Show, (forall x.
CreateEvaluationResponse -> Rep CreateEvaluationResponse x)
-> (forall x.
Rep CreateEvaluationResponse x -> CreateEvaluationResponse)
-> Generic CreateEvaluationResponse
forall x.
Rep CreateEvaluationResponse x -> CreateEvaluationResponse
forall x.
CreateEvaluationResponse -> Rep CreateEvaluationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEvaluationResponse x -> CreateEvaluationResponse
$cfrom :: forall x.
CreateEvaluationResponse -> Rep CreateEvaluationResponse x
Prelude.Generic)
newCreateEvaluationResponse ::
Prelude.Int ->
CreateEvaluationResponse
newCreateEvaluationResponse :: Int -> CreateEvaluationResponse
newCreateEvaluationResponse Int
pHttpStatus_ =
CreateEvaluationResponse' :: Maybe Text -> Int -> CreateEvaluationResponse
CreateEvaluationResponse'
{ $sel:evaluationId:CreateEvaluationResponse' :: Maybe Text
evaluationId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateEvaluationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createEvaluationResponse_evaluationId :: Lens.Lens' CreateEvaluationResponse (Prelude.Maybe Prelude.Text)
createEvaluationResponse_evaluationId :: (Maybe Text -> f (Maybe Text))
-> CreateEvaluationResponse -> f CreateEvaluationResponse
createEvaluationResponse_evaluationId = (CreateEvaluationResponse -> Maybe Text)
-> (CreateEvaluationResponse
-> Maybe Text -> CreateEvaluationResponse)
-> Lens
CreateEvaluationResponse
CreateEvaluationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEvaluationResponse' {Maybe Text
evaluationId :: Maybe Text
$sel:evaluationId:CreateEvaluationResponse' :: CreateEvaluationResponse -> Maybe Text
evaluationId} -> Maybe Text
evaluationId) (\s :: CreateEvaluationResponse
s@CreateEvaluationResponse' {} Maybe Text
a -> CreateEvaluationResponse
s {$sel:evaluationId:CreateEvaluationResponse' :: Maybe Text
evaluationId = Maybe Text
a} :: CreateEvaluationResponse)
createEvaluationResponse_httpStatus :: Lens.Lens' CreateEvaluationResponse Prelude.Int
createEvaluationResponse_httpStatus :: (Int -> f Int)
-> CreateEvaluationResponse -> f CreateEvaluationResponse
createEvaluationResponse_httpStatus = (CreateEvaluationResponse -> Int)
-> (CreateEvaluationResponse -> Int -> CreateEvaluationResponse)
-> Lens CreateEvaluationResponse CreateEvaluationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEvaluationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateEvaluationResponse' :: CreateEvaluationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateEvaluationResponse
s@CreateEvaluationResponse' {} Int
a -> CreateEvaluationResponse
s {$sel:httpStatus:CreateEvaluationResponse' :: Int
httpStatus = Int
a} :: CreateEvaluationResponse)
instance Prelude.NFData CreateEvaluationResponse