{-# 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.CreateExperiment
(
CreateExperiment (..),
newCreateExperiment,
createExperiment_displayName,
createExperiment_description,
createExperiment_tags,
createExperiment_experimentName,
CreateExperimentResponse (..),
newCreateExperimentResponse,
createExperimentResponse_experimentArn,
createExperimentResponse_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 CreateExperiment = CreateExperiment'
{
CreateExperiment -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
CreateExperiment -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateExperiment -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateExperiment -> Text
experimentName :: Prelude.Text
}
deriving (CreateExperiment -> CreateExperiment -> Bool
(CreateExperiment -> CreateExperiment -> Bool)
-> (CreateExperiment -> CreateExperiment -> Bool)
-> Eq CreateExperiment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateExperiment -> CreateExperiment -> Bool
$c/= :: CreateExperiment -> CreateExperiment -> Bool
== :: CreateExperiment -> CreateExperiment -> Bool
$c== :: CreateExperiment -> CreateExperiment -> Bool
Prelude.Eq, ReadPrec [CreateExperiment]
ReadPrec CreateExperiment
Int -> ReadS CreateExperiment
ReadS [CreateExperiment]
(Int -> ReadS CreateExperiment)
-> ReadS [CreateExperiment]
-> ReadPrec CreateExperiment
-> ReadPrec [CreateExperiment]
-> Read CreateExperiment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateExperiment]
$creadListPrec :: ReadPrec [CreateExperiment]
readPrec :: ReadPrec CreateExperiment
$creadPrec :: ReadPrec CreateExperiment
readList :: ReadS [CreateExperiment]
$creadList :: ReadS [CreateExperiment]
readsPrec :: Int -> ReadS CreateExperiment
$creadsPrec :: Int -> ReadS CreateExperiment
Prelude.Read, Int -> CreateExperiment -> ShowS
[CreateExperiment] -> ShowS
CreateExperiment -> String
(Int -> CreateExperiment -> ShowS)
-> (CreateExperiment -> String)
-> ([CreateExperiment] -> ShowS)
-> Show CreateExperiment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateExperiment] -> ShowS
$cshowList :: [CreateExperiment] -> ShowS
show :: CreateExperiment -> String
$cshow :: CreateExperiment -> String
showsPrec :: Int -> CreateExperiment -> ShowS
$cshowsPrec :: Int -> CreateExperiment -> ShowS
Prelude.Show, (forall x. CreateExperiment -> Rep CreateExperiment x)
-> (forall x. Rep CreateExperiment x -> CreateExperiment)
-> Generic CreateExperiment
forall x. Rep CreateExperiment x -> CreateExperiment
forall x. CreateExperiment -> Rep CreateExperiment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateExperiment x -> CreateExperiment
$cfrom :: forall x. CreateExperiment -> Rep CreateExperiment x
Prelude.Generic)
newCreateExperiment ::
Prelude.Text ->
CreateExperiment
newCreateExperiment :: Text -> CreateExperiment
newCreateExperiment Text
pExperimentName_ =
CreateExperiment' :: Maybe Text -> Maybe Text -> Maybe [Tag] -> Text -> CreateExperiment
CreateExperiment'
{ $sel:displayName:CreateExperiment' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateExperiment' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateExperiment' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:experimentName:CreateExperiment' :: Text
experimentName = Text
pExperimentName_
}
createExperiment_displayName :: Lens.Lens' CreateExperiment (Prelude.Maybe Prelude.Text)
createExperiment_displayName :: (Maybe Text -> f (Maybe Text))
-> CreateExperiment -> f CreateExperiment
createExperiment_displayName = (CreateExperiment -> Maybe Text)
-> (CreateExperiment -> Maybe Text -> CreateExperiment)
-> Lens CreateExperiment CreateExperiment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExperiment' {Maybe Text
displayName :: Maybe Text
$sel:displayName:CreateExperiment' :: CreateExperiment -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: CreateExperiment
s@CreateExperiment' {} Maybe Text
a -> CreateExperiment
s {$sel:displayName:CreateExperiment' :: Maybe Text
displayName = Maybe Text
a} :: CreateExperiment)
createExperiment_description :: Lens.Lens' CreateExperiment (Prelude.Maybe Prelude.Text)
createExperiment_description :: (Maybe Text -> f (Maybe Text))
-> CreateExperiment -> f CreateExperiment
createExperiment_description = (CreateExperiment -> Maybe Text)
-> (CreateExperiment -> Maybe Text -> CreateExperiment)
-> Lens CreateExperiment CreateExperiment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExperiment' {Maybe Text
description :: Maybe Text
$sel:description:CreateExperiment' :: CreateExperiment -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateExperiment
s@CreateExperiment' {} Maybe Text
a -> CreateExperiment
s {$sel:description:CreateExperiment' :: Maybe Text
description = Maybe Text
a} :: CreateExperiment)
createExperiment_tags :: Lens.Lens' CreateExperiment (Prelude.Maybe [Tag])
createExperiment_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateExperiment -> f CreateExperiment
createExperiment_tags = (CreateExperiment -> Maybe [Tag])
-> (CreateExperiment -> Maybe [Tag] -> CreateExperiment)
-> Lens
CreateExperiment CreateExperiment (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExperiment' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateExperiment' :: CreateExperiment -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateExperiment
s@CreateExperiment' {} Maybe [Tag]
a -> CreateExperiment
s {$sel:tags:CreateExperiment' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateExperiment) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateExperiment -> f CreateExperiment)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateExperiment
-> f CreateExperiment
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
createExperiment_experimentName :: Lens.Lens' CreateExperiment Prelude.Text
createExperiment_experimentName :: (Text -> f Text) -> CreateExperiment -> f CreateExperiment
createExperiment_experimentName = (CreateExperiment -> Text)
-> (CreateExperiment -> Text -> CreateExperiment)
-> Lens CreateExperiment CreateExperiment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExperiment' {Text
experimentName :: Text
$sel:experimentName:CreateExperiment' :: CreateExperiment -> Text
experimentName} -> Text
experimentName) (\s :: CreateExperiment
s@CreateExperiment' {} Text
a -> CreateExperiment
s {$sel:experimentName:CreateExperiment' :: Text
experimentName = Text
a} :: CreateExperiment)
instance Core.AWSRequest CreateExperiment where
type
AWSResponse CreateExperiment =
CreateExperimentResponse
request :: CreateExperiment -> Request CreateExperiment
request = Service -> CreateExperiment -> Request CreateExperiment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateExperiment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateExperiment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateExperiment))
-> Logger
-> Service
-> Proxy CreateExperiment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateExperiment)))
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 -> CreateExperimentResponse
CreateExperimentResponse'
(Maybe Text -> Int -> CreateExperimentResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateExperimentResponse)
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
"ExperimentArn")
Either String (Int -> CreateExperimentResponse)
-> Either String Int -> Either String CreateExperimentResponse
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 CreateExperiment
instance Prelude.NFData CreateExperiment
instance Core.ToHeaders CreateExperiment where
toHeaders :: CreateExperiment -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateExperiment -> 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.CreateExperiment" :: 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 CreateExperiment where
toJSON :: CreateExperiment -> Value
toJSON CreateExperiment' {Maybe [Tag]
Maybe Text
Text
experimentName :: Text
tags :: Maybe [Tag]
description :: Maybe Text
displayName :: Maybe Text
$sel:experimentName:CreateExperiment' :: CreateExperiment -> Text
$sel:tags:CreateExperiment' :: CreateExperiment -> Maybe [Tag]
$sel:description:CreateExperiment' :: CreateExperiment -> Maybe Text
$sel:displayName:CreateExperiment' :: CreateExperiment -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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
"Description" 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
description,
(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
"ExperimentName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
experimentName)
]
)
instance Core.ToPath CreateExperiment where
toPath :: CreateExperiment -> ByteString
toPath = ByteString -> CreateExperiment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateExperiment where
toQuery :: CreateExperiment -> QueryString
toQuery = QueryString -> CreateExperiment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateExperimentResponse = CreateExperimentResponse'
{
CreateExperimentResponse -> Maybe Text
experimentArn :: Prelude.Maybe Prelude.Text,
CreateExperimentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateExperimentResponse -> CreateExperimentResponse -> Bool
(CreateExperimentResponse -> CreateExperimentResponse -> Bool)
-> (CreateExperimentResponse -> CreateExperimentResponse -> Bool)
-> Eq CreateExperimentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateExperimentResponse -> CreateExperimentResponse -> Bool
$c/= :: CreateExperimentResponse -> CreateExperimentResponse -> Bool
== :: CreateExperimentResponse -> CreateExperimentResponse -> Bool
$c== :: CreateExperimentResponse -> CreateExperimentResponse -> Bool
Prelude.Eq, ReadPrec [CreateExperimentResponse]
ReadPrec CreateExperimentResponse
Int -> ReadS CreateExperimentResponse
ReadS [CreateExperimentResponse]
(Int -> ReadS CreateExperimentResponse)
-> ReadS [CreateExperimentResponse]
-> ReadPrec CreateExperimentResponse
-> ReadPrec [CreateExperimentResponse]
-> Read CreateExperimentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateExperimentResponse]
$creadListPrec :: ReadPrec [CreateExperimentResponse]
readPrec :: ReadPrec CreateExperimentResponse
$creadPrec :: ReadPrec CreateExperimentResponse
readList :: ReadS [CreateExperimentResponse]
$creadList :: ReadS [CreateExperimentResponse]
readsPrec :: Int -> ReadS CreateExperimentResponse
$creadsPrec :: Int -> ReadS CreateExperimentResponse
Prelude.Read, Int -> CreateExperimentResponse -> ShowS
[CreateExperimentResponse] -> ShowS
CreateExperimentResponse -> String
(Int -> CreateExperimentResponse -> ShowS)
-> (CreateExperimentResponse -> String)
-> ([CreateExperimentResponse] -> ShowS)
-> Show CreateExperimentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateExperimentResponse] -> ShowS
$cshowList :: [CreateExperimentResponse] -> ShowS
show :: CreateExperimentResponse -> String
$cshow :: CreateExperimentResponse -> String
showsPrec :: Int -> CreateExperimentResponse -> ShowS
$cshowsPrec :: Int -> CreateExperimentResponse -> ShowS
Prelude.Show, (forall x.
CreateExperimentResponse -> Rep CreateExperimentResponse x)
-> (forall x.
Rep CreateExperimentResponse x -> CreateExperimentResponse)
-> Generic CreateExperimentResponse
forall x.
Rep CreateExperimentResponse x -> CreateExperimentResponse
forall x.
CreateExperimentResponse -> Rep CreateExperimentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateExperimentResponse x -> CreateExperimentResponse
$cfrom :: forall x.
CreateExperimentResponse -> Rep CreateExperimentResponse x
Prelude.Generic)
newCreateExperimentResponse ::
Prelude.Int ->
CreateExperimentResponse
newCreateExperimentResponse :: Int -> CreateExperimentResponse
newCreateExperimentResponse Int
pHttpStatus_ =
CreateExperimentResponse' :: Maybe Text -> Int -> CreateExperimentResponse
CreateExperimentResponse'
{ $sel:experimentArn:CreateExperimentResponse' :: Maybe Text
experimentArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateExperimentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createExperimentResponse_experimentArn :: Lens.Lens' CreateExperimentResponse (Prelude.Maybe Prelude.Text)
createExperimentResponse_experimentArn :: (Maybe Text -> f (Maybe Text))
-> CreateExperimentResponse -> f CreateExperimentResponse
createExperimentResponse_experimentArn = (CreateExperimentResponse -> Maybe Text)
-> (CreateExperimentResponse
-> Maybe Text -> CreateExperimentResponse)
-> Lens
CreateExperimentResponse
CreateExperimentResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExperimentResponse' {Maybe Text
experimentArn :: Maybe Text
$sel:experimentArn:CreateExperimentResponse' :: CreateExperimentResponse -> Maybe Text
experimentArn} -> Maybe Text
experimentArn) (\s :: CreateExperimentResponse
s@CreateExperimentResponse' {} Maybe Text
a -> CreateExperimentResponse
s {$sel:experimentArn:CreateExperimentResponse' :: Maybe Text
experimentArn = Maybe Text
a} :: CreateExperimentResponse)
createExperimentResponse_httpStatus :: Lens.Lens' CreateExperimentResponse Prelude.Int
createExperimentResponse_httpStatus :: (Int -> f Int)
-> CreateExperimentResponse -> f CreateExperimentResponse
createExperimentResponse_httpStatus = (CreateExperimentResponse -> Int)
-> (CreateExperimentResponse -> Int -> CreateExperimentResponse)
-> Lens CreateExperimentResponse CreateExperimentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExperimentResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateExperimentResponse' :: CreateExperimentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateExperimentResponse
s@CreateExperimentResponse' {} Int
a -> CreateExperimentResponse
s {$sel:httpStatus:CreateExperimentResponse' :: Int
httpStatus = Int
a} :: CreateExperimentResponse)
instance Prelude.NFData CreateExperimentResponse