{-# 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.SageMaker.CreateTrial
(
CreateTrial (..),
newCreateTrial,
createTrial_metadataProperties,
createTrial_displayName,
createTrial_tags,
createTrial_trialName,
createTrial_experimentName,
CreateTrialResponse (..),
newCreateTrialResponse,
createTrialResponse_trialArn,
createTrialResponse_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.SageMaker.Types
data CreateTrial = CreateTrial'
{ CreateTrial -> Maybe MetadataProperties
metadataProperties :: Prelude.Maybe MetadataProperties,
CreateTrial -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
CreateTrial -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateTrial -> Text
trialName :: Prelude.Text,
CreateTrial -> Text
experimentName :: Prelude.Text
}
deriving (CreateTrial -> CreateTrial -> Bool
(CreateTrial -> CreateTrial -> Bool)
-> (CreateTrial -> CreateTrial -> Bool) -> Eq CreateTrial
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTrial -> CreateTrial -> Bool
$c/= :: CreateTrial -> CreateTrial -> Bool
== :: CreateTrial -> CreateTrial -> Bool
$c== :: CreateTrial -> CreateTrial -> Bool
Prelude.Eq, ReadPrec [CreateTrial]
ReadPrec CreateTrial
Int -> ReadS CreateTrial
ReadS [CreateTrial]
(Int -> ReadS CreateTrial)
-> ReadS [CreateTrial]
-> ReadPrec CreateTrial
-> ReadPrec [CreateTrial]
-> Read CreateTrial
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTrial]
$creadListPrec :: ReadPrec [CreateTrial]
readPrec :: ReadPrec CreateTrial
$creadPrec :: ReadPrec CreateTrial
readList :: ReadS [CreateTrial]
$creadList :: ReadS [CreateTrial]
readsPrec :: Int -> ReadS CreateTrial
$creadsPrec :: Int -> ReadS CreateTrial
Prelude.Read, Int -> CreateTrial -> ShowS
[CreateTrial] -> ShowS
CreateTrial -> String
(Int -> CreateTrial -> ShowS)
-> (CreateTrial -> String)
-> ([CreateTrial] -> ShowS)
-> Show CreateTrial
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTrial] -> ShowS
$cshowList :: [CreateTrial] -> ShowS
show :: CreateTrial -> String
$cshow :: CreateTrial -> String
showsPrec :: Int -> CreateTrial -> ShowS
$cshowsPrec :: Int -> CreateTrial -> ShowS
Prelude.Show, (forall x. CreateTrial -> Rep CreateTrial x)
-> (forall x. Rep CreateTrial x -> CreateTrial)
-> Generic CreateTrial
forall x. Rep CreateTrial x -> CreateTrial
forall x. CreateTrial -> Rep CreateTrial x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTrial x -> CreateTrial
$cfrom :: forall x. CreateTrial -> Rep CreateTrial x
Prelude.Generic)
newCreateTrial ::
Prelude.Text ->
Prelude.Text ->
CreateTrial
newCreateTrial :: Text -> Text -> CreateTrial
newCreateTrial Text
pTrialName_ Text
pExperimentName_ =
CreateTrial' :: Maybe MetadataProperties
-> Maybe Text -> Maybe [Tag] -> Text -> Text -> CreateTrial
CreateTrial'
{ $sel:metadataProperties:CreateTrial' :: Maybe MetadataProperties
metadataProperties = Maybe MetadataProperties
forall a. Maybe a
Prelude.Nothing,
$sel:displayName:CreateTrial' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateTrial' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:trialName:CreateTrial' :: Text
trialName = Text
pTrialName_,
$sel:experimentName:CreateTrial' :: Text
experimentName = Text
pExperimentName_
}
createTrial_metadataProperties :: Lens.Lens' CreateTrial (Prelude.Maybe MetadataProperties)
createTrial_metadataProperties :: (Maybe MetadataProperties -> f (Maybe MetadataProperties))
-> CreateTrial -> f CreateTrial
createTrial_metadataProperties = (CreateTrial -> Maybe MetadataProperties)
-> (CreateTrial -> Maybe MetadataProperties -> CreateTrial)
-> Lens
CreateTrial
CreateTrial
(Maybe MetadataProperties)
(Maybe MetadataProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrial' {Maybe MetadataProperties
metadataProperties :: Maybe MetadataProperties
$sel:metadataProperties:CreateTrial' :: CreateTrial -> Maybe MetadataProperties
metadataProperties} -> Maybe MetadataProperties
metadataProperties) (\s :: CreateTrial
s@CreateTrial' {} Maybe MetadataProperties
a -> CreateTrial
s {$sel:metadataProperties:CreateTrial' :: Maybe MetadataProperties
metadataProperties = Maybe MetadataProperties
a} :: CreateTrial)
createTrial_displayName :: Lens.Lens' CreateTrial (Prelude.Maybe Prelude.Text)
createTrial_displayName :: (Maybe Text -> f (Maybe Text)) -> CreateTrial -> f CreateTrial
createTrial_displayName = (CreateTrial -> Maybe Text)
-> (CreateTrial -> Maybe Text -> CreateTrial)
-> Lens CreateTrial CreateTrial (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrial' {Maybe Text
displayName :: Maybe Text
$sel:displayName:CreateTrial' :: CreateTrial -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: CreateTrial
s@CreateTrial' {} Maybe Text
a -> CreateTrial
s {$sel:displayName:CreateTrial' :: Maybe Text
displayName = Maybe Text
a} :: CreateTrial)
createTrial_tags :: Lens.Lens' CreateTrial (Prelude.Maybe [Tag])
createTrial_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateTrial -> f CreateTrial
createTrial_tags = (CreateTrial -> Maybe [Tag])
-> (CreateTrial -> Maybe [Tag] -> CreateTrial)
-> Lens CreateTrial CreateTrial (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrial' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateTrial' :: CreateTrial -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateTrial
s@CreateTrial' {} Maybe [Tag]
a -> CreateTrial
s {$sel:tags:CreateTrial' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateTrial) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateTrial -> f CreateTrial)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateTrial
-> f CreateTrial
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createTrial_trialName :: Lens.Lens' CreateTrial Prelude.Text
createTrial_trialName :: (Text -> f Text) -> CreateTrial -> f CreateTrial
createTrial_trialName = (CreateTrial -> Text)
-> (CreateTrial -> Text -> CreateTrial)
-> Lens CreateTrial CreateTrial Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrial' {Text
trialName :: Text
$sel:trialName:CreateTrial' :: CreateTrial -> Text
trialName} -> Text
trialName) (\s :: CreateTrial
s@CreateTrial' {} Text
a -> CreateTrial
s {$sel:trialName:CreateTrial' :: Text
trialName = Text
a} :: CreateTrial)
createTrial_experimentName :: Lens.Lens' CreateTrial Prelude.Text
createTrial_experimentName :: (Text -> f Text) -> CreateTrial -> f CreateTrial
createTrial_experimentName = (CreateTrial -> Text)
-> (CreateTrial -> Text -> CreateTrial)
-> Lens CreateTrial CreateTrial Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrial' {Text
experimentName :: Text
$sel:experimentName:CreateTrial' :: CreateTrial -> Text
experimentName} -> Text
experimentName) (\s :: CreateTrial
s@CreateTrial' {} Text
a -> CreateTrial
s {$sel:experimentName:CreateTrial' :: Text
experimentName = Text
a} :: CreateTrial)
instance Core.AWSRequest CreateTrial where
type AWSResponse CreateTrial = CreateTrialResponse
request :: CreateTrial -> Request CreateTrial
request = Service -> CreateTrial -> Request CreateTrial
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateTrial
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTrial)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateTrial))
-> Logger
-> Service
-> Proxy CreateTrial
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTrial)))
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 -> CreateTrialResponse
CreateTrialResponse'
(Maybe Text -> Int -> CreateTrialResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateTrialResponse)
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
"TrialArn")
Either String (Int -> CreateTrialResponse)
-> Either String Int -> Either String CreateTrialResponse
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 CreateTrial
instance Prelude.NFData CreateTrial
instance Core.ToHeaders CreateTrial where
toHeaders :: CreateTrial -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateTrial -> 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
"SageMaker.CreateTrial" :: 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 CreateTrial where
toJSON :: CreateTrial -> Value
toJSON CreateTrial' {Maybe [Tag]
Maybe Text
Maybe MetadataProperties
Text
experimentName :: Text
trialName :: Text
tags :: Maybe [Tag]
displayName :: Maybe Text
metadataProperties :: Maybe MetadataProperties
$sel:experimentName:CreateTrial' :: CreateTrial -> Text
$sel:trialName:CreateTrial' :: CreateTrial -> Text
$sel:tags:CreateTrial' :: CreateTrial -> Maybe [Tag]
$sel:displayName:CreateTrial' :: CreateTrial -> Maybe Text
$sel:metadataProperties:CreateTrial' :: CreateTrial -> Maybe MetadataProperties
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MetadataProperties" Text -> MetadataProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(MetadataProperties -> Pair)
-> Maybe MetadataProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetadataProperties
metadataProperties,
(Text
"DisplayName" 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
displayName,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TrialName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
trialName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ExperimentName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
experimentName)
]
)
instance Core.ToPath CreateTrial where
toPath :: CreateTrial -> ByteString
toPath = ByteString -> CreateTrial -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateTrial where
toQuery :: CreateTrial -> QueryString
toQuery = QueryString -> CreateTrial -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateTrialResponse = CreateTrialResponse'
{
CreateTrialResponse -> Maybe Text
trialArn :: Prelude.Maybe Prelude.Text,
CreateTrialResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateTrialResponse -> CreateTrialResponse -> Bool
(CreateTrialResponse -> CreateTrialResponse -> Bool)
-> (CreateTrialResponse -> CreateTrialResponse -> Bool)
-> Eq CreateTrialResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTrialResponse -> CreateTrialResponse -> Bool
$c/= :: CreateTrialResponse -> CreateTrialResponse -> Bool
== :: CreateTrialResponse -> CreateTrialResponse -> Bool
$c== :: CreateTrialResponse -> CreateTrialResponse -> Bool
Prelude.Eq, ReadPrec [CreateTrialResponse]
ReadPrec CreateTrialResponse
Int -> ReadS CreateTrialResponse
ReadS [CreateTrialResponse]
(Int -> ReadS CreateTrialResponse)
-> ReadS [CreateTrialResponse]
-> ReadPrec CreateTrialResponse
-> ReadPrec [CreateTrialResponse]
-> Read CreateTrialResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTrialResponse]
$creadListPrec :: ReadPrec [CreateTrialResponse]
readPrec :: ReadPrec CreateTrialResponse
$creadPrec :: ReadPrec CreateTrialResponse
readList :: ReadS [CreateTrialResponse]
$creadList :: ReadS [CreateTrialResponse]
readsPrec :: Int -> ReadS CreateTrialResponse
$creadsPrec :: Int -> ReadS CreateTrialResponse
Prelude.Read, Int -> CreateTrialResponse -> ShowS
[CreateTrialResponse] -> ShowS
CreateTrialResponse -> String
(Int -> CreateTrialResponse -> ShowS)
-> (CreateTrialResponse -> String)
-> ([CreateTrialResponse] -> ShowS)
-> Show CreateTrialResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTrialResponse] -> ShowS
$cshowList :: [CreateTrialResponse] -> ShowS
show :: CreateTrialResponse -> String
$cshow :: CreateTrialResponse -> String
showsPrec :: Int -> CreateTrialResponse -> ShowS
$cshowsPrec :: Int -> CreateTrialResponse -> ShowS
Prelude.Show, (forall x. CreateTrialResponse -> Rep CreateTrialResponse x)
-> (forall x. Rep CreateTrialResponse x -> CreateTrialResponse)
-> Generic CreateTrialResponse
forall x. Rep CreateTrialResponse x -> CreateTrialResponse
forall x. CreateTrialResponse -> Rep CreateTrialResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTrialResponse x -> CreateTrialResponse
$cfrom :: forall x. CreateTrialResponse -> Rep CreateTrialResponse x
Prelude.Generic)
newCreateTrialResponse ::
Prelude.Int ->
CreateTrialResponse
newCreateTrialResponse :: Int -> CreateTrialResponse
newCreateTrialResponse Int
pHttpStatus_ =
CreateTrialResponse' :: Maybe Text -> Int -> CreateTrialResponse
CreateTrialResponse'
{ $sel:trialArn:CreateTrialResponse' :: Maybe Text
trialArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateTrialResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createTrialResponse_trialArn :: Lens.Lens' CreateTrialResponse (Prelude.Maybe Prelude.Text)
createTrialResponse_trialArn :: (Maybe Text -> f (Maybe Text))
-> CreateTrialResponse -> f CreateTrialResponse
createTrialResponse_trialArn = (CreateTrialResponse -> Maybe Text)
-> (CreateTrialResponse -> Maybe Text -> CreateTrialResponse)
-> Lens
CreateTrialResponse CreateTrialResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrialResponse' {Maybe Text
trialArn :: Maybe Text
$sel:trialArn:CreateTrialResponse' :: CreateTrialResponse -> Maybe Text
trialArn} -> Maybe Text
trialArn) (\s :: CreateTrialResponse
s@CreateTrialResponse' {} Maybe Text
a -> CreateTrialResponse
s {$sel:trialArn:CreateTrialResponse' :: Maybe Text
trialArn = Maybe Text
a} :: CreateTrialResponse)
createTrialResponse_httpStatus :: Lens.Lens' CreateTrialResponse Prelude.Int
createTrialResponse_httpStatus :: (Int -> f Int) -> CreateTrialResponse -> f CreateTrialResponse
createTrialResponse_httpStatus = (CreateTrialResponse -> Int)
-> (CreateTrialResponse -> Int -> CreateTrialResponse)
-> Lens CreateTrialResponse CreateTrialResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrialResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTrialResponse' :: CreateTrialResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTrialResponse
s@CreateTrialResponse' {} Int
a -> CreateTrialResponse
s {$sel:httpStatus:CreateTrialResponse' :: Int
httpStatus = Int
a} :: CreateTrialResponse)
instance Prelude.NFData CreateTrialResponse