{-# 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.Personalize.CreateSolutionVersion
(
CreateSolutionVersion (..),
newCreateSolutionVersion,
createSolutionVersion_trainingMode,
createSolutionVersion_solutionArn,
CreateSolutionVersionResponse (..),
newCreateSolutionVersionResponse,
createSolutionVersionResponse_solutionVersionArn,
createSolutionVersionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateSolutionVersion = CreateSolutionVersion'
{
CreateSolutionVersion -> Maybe TrainingMode
trainingMode :: Prelude.Maybe TrainingMode,
CreateSolutionVersion -> Text
solutionArn :: Prelude.Text
}
deriving (CreateSolutionVersion -> CreateSolutionVersion -> Bool
(CreateSolutionVersion -> CreateSolutionVersion -> Bool)
-> (CreateSolutionVersion -> CreateSolutionVersion -> Bool)
-> Eq CreateSolutionVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSolutionVersion -> CreateSolutionVersion -> Bool
$c/= :: CreateSolutionVersion -> CreateSolutionVersion -> Bool
== :: CreateSolutionVersion -> CreateSolutionVersion -> Bool
$c== :: CreateSolutionVersion -> CreateSolutionVersion -> Bool
Prelude.Eq, ReadPrec [CreateSolutionVersion]
ReadPrec CreateSolutionVersion
Int -> ReadS CreateSolutionVersion
ReadS [CreateSolutionVersion]
(Int -> ReadS CreateSolutionVersion)
-> ReadS [CreateSolutionVersion]
-> ReadPrec CreateSolutionVersion
-> ReadPrec [CreateSolutionVersion]
-> Read CreateSolutionVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSolutionVersion]
$creadListPrec :: ReadPrec [CreateSolutionVersion]
readPrec :: ReadPrec CreateSolutionVersion
$creadPrec :: ReadPrec CreateSolutionVersion
readList :: ReadS [CreateSolutionVersion]
$creadList :: ReadS [CreateSolutionVersion]
readsPrec :: Int -> ReadS CreateSolutionVersion
$creadsPrec :: Int -> ReadS CreateSolutionVersion
Prelude.Read, Int -> CreateSolutionVersion -> ShowS
[CreateSolutionVersion] -> ShowS
CreateSolutionVersion -> String
(Int -> CreateSolutionVersion -> ShowS)
-> (CreateSolutionVersion -> String)
-> ([CreateSolutionVersion] -> ShowS)
-> Show CreateSolutionVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSolutionVersion] -> ShowS
$cshowList :: [CreateSolutionVersion] -> ShowS
show :: CreateSolutionVersion -> String
$cshow :: CreateSolutionVersion -> String
showsPrec :: Int -> CreateSolutionVersion -> ShowS
$cshowsPrec :: Int -> CreateSolutionVersion -> ShowS
Prelude.Show, (forall x. CreateSolutionVersion -> Rep CreateSolutionVersion x)
-> (forall x. Rep CreateSolutionVersion x -> CreateSolutionVersion)
-> Generic CreateSolutionVersion
forall x. Rep CreateSolutionVersion x -> CreateSolutionVersion
forall x. CreateSolutionVersion -> Rep CreateSolutionVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSolutionVersion x -> CreateSolutionVersion
$cfrom :: forall x. CreateSolutionVersion -> Rep CreateSolutionVersion x
Prelude.Generic)
newCreateSolutionVersion ::
Prelude.Text ->
CreateSolutionVersion
newCreateSolutionVersion :: Text -> CreateSolutionVersion
newCreateSolutionVersion Text
pSolutionArn_ =
CreateSolutionVersion' :: Maybe TrainingMode -> Text -> CreateSolutionVersion
CreateSolutionVersion'
{ $sel:trainingMode:CreateSolutionVersion' :: Maybe TrainingMode
trainingMode =
Maybe TrainingMode
forall a. Maybe a
Prelude.Nothing,
$sel:solutionArn:CreateSolutionVersion' :: Text
solutionArn = Text
pSolutionArn_
}
createSolutionVersion_trainingMode :: Lens.Lens' CreateSolutionVersion (Prelude.Maybe TrainingMode)
createSolutionVersion_trainingMode :: (Maybe TrainingMode -> f (Maybe TrainingMode))
-> CreateSolutionVersion -> f CreateSolutionVersion
createSolutionVersion_trainingMode = (CreateSolutionVersion -> Maybe TrainingMode)
-> (CreateSolutionVersion
-> Maybe TrainingMode -> CreateSolutionVersion)
-> Lens
CreateSolutionVersion
CreateSolutionVersion
(Maybe TrainingMode)
(Maybe TrainingMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolutionVersion' {Maybe TrainingMode
trainingMode :: Maybe TrainingMode
$sel:trainingMode:CreateSolutionVersion' :: CreateSolutionVersion -> Maybe TrainingMode
trainingMode} -> Maybe TrainingMode
trainingMode) (\s :: CreateSolutionVersion
s@CreateSolutionVersion' {} Maybe TrainingMode
a -> CreateSolutionVersion
s {$sel:trainingMode:CreateSolutionVersion' :: Maybe TrainingMode
trainingMode = Maybe TrainingMode
a} :: CreateSolutionVersion)
createSolutionVersion_solutionArn :: Lens.Lens' CreateSolutionVersion Prelude.Text
createSolutionVersion_solutionArn :: (Text -> f Text)
-> CreateSolutionVersion -> f CreateSolutionVersion
createSolutionVersion_solutionArn = (CreateSolutionVersion -> Text)
-> (CreateSolutionVersion -> Text -> CreateSolutionVersion)
-> Lens CreateSolutionVersion CreateSolutionVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolutionVersion' {Text
solutionArn :: Text
$sel:solutionArn:CreateSolutionVersion' :: CreateSolutionVersion -> Text
solutionArn} -> Text
solutionArn) (\s :: CreateSolutionVersion
s@CreateSolutionVersion' {} Text
a -> CreateSolutionVersion
s {$sel:solutionArn:CreateSolutionVersion' :: Text
solutionArn = Text
a} :: CreateSolutionVersion)
instance Core.AWSRequest CreateSolutionVersion where
type
AWSResponse CreateSolutionVersion =
CreateSolutionVersionResponse
request :: CreateSolutionVersion -> Request CreateSolutionVersion
request = Service -> CreateSolutionVersion -> Request CreateSolutionVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateSolutionVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSolutionVersion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateSolutionVersion))
-> Logger
-> Service
-> Proxy CreateSolutionVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSolutionVersion)))
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 -> CreateSolutionVersionResponse
CreateSolutionVersionResponse'
(Maybe Text -> Int -> CreateSolutionVersionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateSolutionVersionResponse)
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
"solutionVersionArn")
Either String (Int -> CreateSolutionVersionResponse)
-> Either String Int -> Either String CreateSolutionVersionResponse
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 CreateSolutionVersion
instance Prelude.NFData CreateSolutionVersion
instance Core.ToHeaders CreateSolutionVersion where
toHeaders :: CreateSolutionVersion -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateSolutionVersion -> 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
"AmazonPersonalize.CreateSolutionVersion" ::
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 CreateSolutionVersion where
toJSON :: CreateSolutionVersion -> Value
toJSON CreateSolutionVersion' {Maybe TrainingMode
Text
solutionArn :: Text
trainingMode :: Maybe TrainingMode
$sel:solutionArn:CreateSolutionVersion' :: CreateSolutionVersion -> Text
$sel:trainingMode:CreateSolutionVersion' :: CreateSolutionVersion -> Maybe TrainingMode
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"trainingMode" Text -> TrainingMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TrainingMode -> Pair) -> Maybe TrainingMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TrainingMode
trainingMode,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"solutionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
solutionArn)
]
)
instance Core.ToPath CreateSolutionVersion where
toPath :: CreateSolutionVersion -> ByteString
toPath = ByteString -> CreateSolutionVersion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateSolutionVersion where
toQuery :: CreateSolutionVersion -> QueryString
toQuery = QueryString -> CreateSolutionVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateSolutionVersionResponse = CreateSolutionVersionResponse'
{
CreateSolutionVersionResponse -> Maybe Text
solutionVersionArn :: Prelude.Maybe Prelude.Text,
CreateSolutionVersionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateSolutionVersionResponse
-> CreateSolutionVersionResponse -> Bool
(CreateSolutionVersionResponse
-> CreateSolutionVersionResponse -> Bool)
-> (CreateSolutionVersionResponse
-> CreateSolutionVersionResponse -> Bool)
-> Eq CreateSolutionVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSolutionVersionResponse
-> CreateSolutionVersionResponse -> Bool
$c/= :: CreateSolutionVersionResponse
-> CreateSolutionVersionResponse -> Bool
== :: CreateSolutionVersionResponse
-> CreateSolutionVersionResponse -> Bool
$c== :: CreateSolutionVersionResponse
-> CreateSolutionVersionResponse -> Bool
Prelude.Eq, ReadPrec [CreateSolutionVersionResponse]
ReadPrec CreateSolutionVersionResponse
Int -> ReadS CreateSolutionVersionResponse
ReadS [CreateSolutionVersionResponse]
(Int -> ReadS CreateSolutionVersionResponse)
-> ReadS [CreateSolutionVersionResponse]
-> ReadPrec CreateSolutionVersionResponse
-> ReadPrec [CreateSolutionVersionResponse]
-> Read CreateSolutionVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSolutionVersionResponse]
$creadListPrec :: ReadPrec [CreateSolutionVersionResponse]
readPrec :: ReadPrec CreateSolutionVersionResponse
$creadPrec :: ReadPrec CreateSolutionVersionResponse
readList :: ReadS [CreateSolutionVersionResponse]
$creadList :: ReadS [CreateSolutionVersionResponse]
readsPrec :: Int -> ReadS CreateSolutionVersionResponse
$creadsPrec :: Int -> ReadS CreateSolutionVersionResponse
Prelude.Read, Int -> CreateSolutionVersionResponse -> ShowS
[CreateSolutionVersionResponse] -> ShowS
CreateSolutionVersionResponse -> String
(Int -> CreateSolutionVersionResponse -> ShowS)
-> (CreateSolutionVersionResponse -> String)
-> ([CreateSolutionVersionResponse] -> ShowS)
-> Show CreateSolutionVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSolutionVersionResponse] -> ShowS
$cshowList :: [CreateSolutionVersionResponse] -> ShowS
show :: CreateSolutionVersionResponse -> String
$cshow :: CreateSolutionVersionResponse -> String
showsPrec :: Int -> CreateSolutionVersionResponse -> ShowS
$cshowsPrec :: Int -> CreateSolutionVersionResponse -> ShowS
Prelude.Show, (forall x.
CreateSolutionVersionResponse
-> Rep CreateSolutionVersionResponse x)
-> (forall x.
Rep CreateSolutionVersionResponse x
-> CreateSolutionVersionResponse)
-> Generic CreateSolutionVersionResponse
forall x.
Rep CreateSolutionVersionResponse x
-> CreateSolutionVersionResponse
forall x.
CreateSolutionVersionResponse
-> Rep CreateSolutionVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSolutionVersionResponse x
-> CreateSolutionVersionResponse
$cfrom :: forall x.
CreateSolutionVersionResponse
-> Rep CreateSolutionVersionResponse x
Prelude.Generic)
newCreateSolutionVersionResponse ::
Prelude.Int ->
CreateSolutionVersionResponse
newCreateSolutionVersionResponse :: Int -> CreateSolutionVersionResponse
newCreateSolutionVersionResponse Int
pHttpStatus_ =
CreateSolutionVersionResponse' :: Maybe Text -> Int -> CreateSolutionVersionResponse
CreateSolutionVersionResponse'
{ $sel:solutionVersionArn:CreateSolutionVersionResponse' :: Maybe Text
solutionVersionArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateSolutionVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createSolutionVersionResponse_solutionVersionArn :: Lens.Lens' CreateSolutionVersionResponse (Prelude.Maybe Prelude.Text)
createSolutionVersionResponse_solutionVersionArn :: (Maybe Text -> f (Maybe Text))
-> CreateSolutionVersionResponse -> f CreateSolutionVersionResponse
createSolutionVersionResponse_solutionVersionArn = (CreateSolutionVersionResponse -> Maybe Text)
-> (CreateSolutionVersionResponse
-> Maybe Text -> CreateSolutionVersionResponse)
-> Lens
CreateSolutionVersionResponse
CreateSolutionVersionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolutionVersionResponse' {Maybe Text
solutionVersionArn :: Maybe Text
$sel:solutionVersionArn:CreateSolutionVersionResponse' :: CreateSolutionVersionResponse -> Maybe Text
solutionVersionArn} -> Maybe Text
solutionVersionArn) (\s :: CreateSolutionVersionResponse
s@CreateSolutionVersionResponse' {} Maybe Text
a -> CreateSolutionVersionResponse
s {$sel:solutionVersionArn:CreateSolutionVersionResponse' :: Maybe Text
solutionVersionArn = Maybe Text
a} :: CreateSolutionVersionResponse)
createSolutionVersionResponse_httpStatus :: Lens.Lens' CreateSolutionVersionResponse Prelude.Int
createSolutionVersionResponse_httpStatus :: (Int -> f Int)
-> CreateSolutionVersionResponse -> f CreateSolutionVersionResponse
createSolutionVersionResponse_httpStatus = (CreateSolutionVersionResponse -> Int)
-> (CreateSolutionVersionResponse
-> Int -> CreateSolutionVersionResponse)
-> Lens
CreateSolutionVersionResponse CreateSolutionVersionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolutionVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSolutionVersionResponse' :: CreateSolutionVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSolutionVersionResponse
s@CreateSolutionVersionResponse' {} Int
a -> CreateSolutionVersionResponse
s {$sel:httpStatus:CreateSolutionVersionResponse' :: Int
httpStatus = Int
a} :: CreateSolutionVersionResponse)
instance Prelude.NFData CreateSolutionVersionResponse