{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Personalize.CreateSolution
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates the configuration for training a model. A trained model is known
-- as a solution. After the configuration is created, you train the model
-- (create a solution) by calling the CreateSolutionVersion operation.
-- Every time you call @CreateSolutionVersion@, a new version of the
-- solution is created.
--
-- After creating a solution version, you check its accuracy by calling
-- GetSolutionMetrics. When you are satisfied with the version, you deploy
-- it using CreateCampaign. The campaign provides recommendations to a
-- client through the
-- <https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html GetRecommendations>
-- API.
--
-- To train a model, Amazon Personalize requires training data and a
-- recipe. The training data comes from the dataset group that you provide
-- in the request. A recipe specifies the training algorithm and a feature
-- transformation. You can specify one of the predefined recipes provided
-- by Amazon Personalize. Alternatively, you can specify @performAutoML@
-- and Amazon Personalize will analyze your data and select the optimum
-- USER_PERSONALIZATION recipe for you.
--
-- Amazon Personalize doesn\'t support configuring the @hpoObjective@ for
-- solution hyperparameter optimization at this time.
--
-- __Status__
--
-- A solution can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
--
-- -   DELETE PENDING > DELETE IN_PROGRESS
--
-- To get the status of the solution, call DescribeSolution. Wait until the
-- status shows as ACTIVE before calling @CreateSolutionVersion@.
--
-- __Related APIs__
--
-- -   ListSolutions
--
-- -   CreateSolutionVersion
--
-- -   DescribeSolution
--
-- -   DeleteSolution
--
-- -   ListSolutionVersions
--
-- -   DescribeSolutionVersion
module Amazonka.Personalize.CreateSolution
  ( -- * Creating a Request
    CreateSolution (..),
    newCreateSolution,

    -- * Request Lenses
    createSolution_performAutoML,
    createSolution_recipeArn,
    createSolution_eventType,
    createSolution_solutionConfig,
    createSolution_performHPO,
    createSolution_name,
    createSolution_datasetGroupArn,

    -- * Destructuring the Response
    CreateSolutionResponse (..),
    newCreateSolutionResponse,

    -- * Response Lenses
    createSolutionResponse_solutionArn,
    createSolutionResponse_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

-- | /See:/ 'newCreateSolution' smart constructor.
data CreateSolution = CreateSolution'
  { -- | Whether to perform automated machine learning (AutoML). The default is
    -- @false@. For this case, you must specify @recipeArn@.
    --
    -- When set to @true@, Amazon Personalize analyzes your training data and
    -- selects the optimal USER_PERSONALIZATION recipe and hyperparameters. In
    -- this case, you must omit @recipeArn@. Amazon Personalize determines the
    -- optimal recipe by running tests with different values for the
    -- hyperparameters. AutoML lengthens the training process as compared to
    -- selecting a specific recipe.
    CreateSolution -> Maybe Bool
performAutoML :: Prelude.Maybe Prelude.Bool,
    -- | The ARN of the recipe to use for model training. Only specified when
    -- @performAutoML@ is false.
    CreateSolution -> Maybe Text
recipeArn :: Prelude.Maybe Prelude.Text,
    -- | When your have multiple event types (using an @EVENT_TYPE@ schema
    -- field), this parameter specifies which event type (for example,
    -- \'click\' or \'like\') is used for training the model.
    --
    -- If you do not provide an @eventType@, Amazon Personalize will use all
    -- interactions for training with equal weight regardless of type.
    CreateSolution -> Maybe Text
eventType :: Prelude.Maybe Prelude.Text,
    -- | The configuration to use with the solution. When @performAutoML@ is set
    -- to true, Amazon Personalize only evaluates the @autoMLConfig@ section of
    -- the solution configuration.
    --
    -- Amazon Personalize doesn\'t support configuring the @hpoObjective@ at
    -- this time.
    CreateSolution -> Maybe SolutionConfig
solutionConfig :: Prelude.Maybe SolutionConfig,
    -- | Whether to perform hyperparameter optimization (HPO) on the specified or
    -- selected recipe. The default is @false@.
    --
    -- When performing AutoML, this parameter is always @true@ and you should
    -- not set it to @false@.
    CreateSolution -> Maybe Bool
performHPO :: Prelude.Maybe Prelude.Bool,
    -- | The name for the solution.
    CreateSolution -> Text
name :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the dataset group that provides the
    -- training data.
    CreateSolution -> Text
datasetGroupArn :: Prelude.Text
  }
  deriving (CreateSolution -> CreateSolution -> Bool
(CreateSolution -> CreateSolution -> Bool)
-> (CreateSolution -> CreateSolution -> Bool) -> Eq CreateSolution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSolution -> CreateSolution -> Bool
$c/= :: CreateSolution -> CreateSolution -> Bool
== :: CreateSolution -> CreateSolution -> Bool
$c== :: CreateSolution -> CreateSolution -> Bool
Prelude.Eq, ReadPrec [CreateSolution]
ReadPrec CreateSolution
Int -> ReadS CreateSolution
ReadS [CreateSolution]
(Int -> ReadS CreateSolution)
-> ReadS [CreateSolution]
-> ReadPrec CreateSolution
-> ReadPrec [CreateSolution]
-> Read CreateSolution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSolution]
$creadListPrec :: ReadPrec [CreateSolution]
readPrec :: ReadPrec CreateSolution
$creadPrec :: ReadPrec CreateSolution
readList :: ReadS [CreateSolution]
$creadList :: ReadS [CreateSolution]
readsPrec :: Int -> ReadS CreateSolution
$creadsPrec :: Int -> ReadS CreateSolution
Prelude.Read, Int -> CreateSolution -> ShowS
[CreateSolution] -> ShowS
CreateSolution -> String
(Int -> CreateSolution -> ShowS)
-> (CreateSolution -> String)
-> ([CreateSolution] -> ShowS)
-> Show CreateSolution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSolution] -> ShowS
$cshowList :: [CreateSolution] -> ShowS
show :: CreateSolution -> String
$cshow :: CreateSolution -> String
showsPrec :: Int -> CreateSolution -> ShowS
$cshowsPrec :: Int -> CreateSolution -> ShowS
Prelude.Show, (forall x. CreateSolution -> Rep CreateSolution x)
-> (forall x. Rep CreateSolution x -> CreateSolution)
-> Generic CreateSolution
forall x. Rep CreateSolution x -> CreateSolution
forall x. CreateSolution -> Rep CreateSolution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSolution x -> CreateSolution
$cfrom :: forall x. CreateSolution -> Rep CreateSolution x
Prelude.Generic)

-- |
-- Create a value of 'CreateSolution' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'performAutoML', 'createSolution_performAutoML' - Whether to perform automated machine learning (AutoML). The default is
-- @false@. For this case, you must specify @recipeArn@.
--
-- When set to @true@, Amazon Personalize analyzes your training data and
-- selects the optimal USER_PERSONALIZATION recipe and hyperparameters. In
-- this case, you must omit @recipeArn@. Amazon Personalize determines the
-- optimal recipe by running tests with different values for the
-- hyperparameters. AutoML lengthens the training process as compared to
-- selecting a specific recipe.
--
-- 'recipeArn', 'createSolution_recipeArn' - The ARN of the recipe to use for model training. Only specified when
-- @performAutoML@ is false.
--
-- 'eventType', 'createSolution_eventType' - When your have multiple event types (using an @EVENT_TYPE@ schema
-- field), this parameter specifies which event type (for example,
-- \'click\' or \'like\') is used for training the model.
--
-- If you do not provide an @eventType@, Amazon Personalize will use all
-- interactions for training with equal weight regardless of type.
--
-- 'solutionConfig', 'createSolution_solutionConfig' - The configuration to use with the solution. When @performAutoML@ is set
-- to true, Amazon Personalize only evaluates the @autoMLConfig@ section of
-- the solution configuration.
--
-- Amazon Personalize doesn\'t support configuring the @hpoObjective@ at
-- this time.
--
-- 'performHPO', 'createSolution_performHPO' - Whether to perform hyperparameter optimization (HPO) on the specified or
-- selected recipe. The default is @false@.
--
-- When performing AutoML, this parameter is always @true@ and you should
-- not set it to @false@.
--
-- 'name', 'createSolution_name' - The name for the solution.
--
-- 'datasetGroupArn', 'createSolution_datasetGroupArn' - The Amazon Resource Name (ARN) of the dataset group that provides the
-- training data.
newCreateSolution ::
  -- | 'name'
  Prelude.Text ->
  -- | 'datasetGroupArn'
  Prelude.Text ->
  CreateSolution
newCreateSolution :: Text -> Text -> CreateSolution
newCreateSolution Text
pName_ Text
pDatasetGroupArn_ =
  CreateSolution' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe SolutionConfig
-> Maybe Bool
-> Text
-> Text
-> CreateSolution
CreateSolution'
    { $sel:performAutoML:CreateSolution' :: Maybe Bool
performAutoML = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:recipeArn:CreateSolution' :: Maybe Text
recipeArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventType:CreateSolution' :: Maybe Text
eventType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:solutionConfig:CreateSolution' :: Maybe SolutionConfig
solutionConfig = Maybe SolutionConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:performHPO:CreateSolution' :: Maybe Bool
performHPO = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateSolution' :: Text
name = Text
pName_,
      $sel:datasetGroupArn:CreateSolution' :: Text
datasetGroupArn = Text
pDatasetGroupArn_
    }

-- | Whether to perform automated machine learning (AutoML). The default is
-- @false@. For this case, you must specify @recipeArn@.
--
-- When set to @true@, Amazon Personalize analyzes your training data and
-- selects the optimal USER_PERSONALIZATION recipe and hyperparameters. In
-- this case, you must omit @recipeArn@. Amazon Personalize determines the
-- optimal recipe by running tests with different values for the
-- hyperparameters. AutoML lengthens the training process as compared to
-- selecting a specific recipe.
createSolution_performAutoML :: Lens.Lens' CreateSolution (Prelude.Maybe Prelude.Bool)
createSolution_performAutoML :: (Maybe Bool -> f (Maybe Bool))
-> CreateSolution -> f CreateSolution
createSolution_performAutoML = (CreateSolution -> Maybe Bool)
-> (CreateSolution -> Maybe Bool -> CreateSolution)
-> Lens CreateSolution CreateSolution (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolution' {Maybe Bool
performAutoML :: Maybe Bool
$sel:performAutoML:CreateSolution' :: CreateSolution -> Maybe Bool
performAutoML} -> Maybe Bool
performAutoML) (\s :: CreateSolution
s@CreateSolution' {} Maybe Bool
a -> CreateSolution
s {$sel:performAutoML:CreateSolution' :: Maybe Bool
performAutoML = Maybe Bool
a} :: CreateSolution)

-- | The ARN of the recipe to use for model training. Only specified when
-- @performAutoML@ is false.
createSolution_recipeArn :: Lens.Lens' CreateSolution (Prelude.Maybe Prelude.Text)
createSolution_recipeArn :: (Maybe Text -> f (Maybe Text))
-> CreateSolution -> f CreateSolution
createSolution_recipeArn = (CreateSolution -> Maybe Text)
-> (CreateSolution -> Maybe Text -> CreateSolution)
-> Lens CreateSolution CreateSolution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolution' {Maybe Text
recipeArn :: Maybe Text
$sel:recipeArn:CreateSolution' :: CreateSolution -> Maybe Text
recipeArn} -> Maybe Text
recipeArn) (\s :: CreateSolution
s@CreateSolution' {} Maybe Text
a -> CreateSolution
s {$sel:recipeArn:CreateSolution' :: Maybe Text
recipeArn = Maybe Text
a} :: CreateSolution)

-- | When your have multiple event types (using an @EVENT_TYPE@ schema
-- field), this parameter specifies which event type (for example,
-- \'click\' or \'like\') is used for training the model.
--
-- If you do not provide an @eventType@, Amazon Personalize will use all
-- interactions for training with equal weight regardless of type.
createSolution_eventType :: Lens.Lens' CreateSolution (Prelude.Maybe Prelude.Text)
createSolution_eventType :: (Maybe Text -> f (Maybe Text))
-> CreateSolution -> f CreateSolution
createSolution_eventType = (CreateSolution -> Maybe Text)
-> (CreateSolution -> Maybe Text -> CreateSolution)
-> Lens CreateSolution CreateSolution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolution' {Maybe Text
eventType :: Maybe Text
$sel:eventType:CreateSolution' :: CreateSolution -> Maybe Text
eventType} -> Maybe Text
eventType) (\s :: CreateSolution
s@CreateSolution' {} Maybe Text
a -> CreateSolution
s {$sel:eventType:CreateSolution' :: Maybe Text
eventType = Maybe Text
a} :: CreateSolution)

-- | The configuration to use with the solution. When @performAutoML@ is set
-- to true, Amazon Personalize only evaluates the @autoMLConfig@ section of
-- the solution configuration.
--
-- Amazon Personalize doesn\'t support configuring the @hpoObjective@ at
-- this time.
createSolution_solutionConfig :: Lens.Lens' CreateSolution (Prelude.Maybe SolutionConfig)
createSolution_solutionConfig :: (Maybe SolutionConfig -> f (Maybe SolutionConfig))
-> CreateSolution -> f CreateSolution
createSolution_solutionConfig = (CreateSolution -> Maybe SolutionConfig)
-> (CreateSolution -> Maybe SolutionConfig -> CreateSolution)
-> Lens
     CreateSolution
     CreateSolution
     (Maybe SolutionConfig)
     (Maybe SolutionConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolution' {Maybe SolutionConfig
solutionConfig :: Maybe SolutionConfig
$sel:solutionConfig:CreateSolution' :: CreateSolution -> Maybe SolutionConfig
solutionConfig} -> Maybe SolutionConfig
solutionConfig) (\s :: CreateSolution
s@CreateSolution' {} Maybe SolutionConfig
a -> CreateSolution
s {$sel:solutionConfig:CreateSolution' :: Maybe SolutionConfig
solutionConfig = Maybe SolutionConfig
a} :: CreateSolution)

-- | Whether to perform hyperparameter optimization (HPO) on the specified or
-- selected recipe. The default is @false@.
--
-- When performing AutoML, this parameter is always @true@ and you should
-- not set it to @false@.
createSolution_performHPO :: Lens.Lens' CreateSolution (Prelude.Maybe Prelude.Bool)
createSolution_performHPO :: (Maybe Bool -> f (Maybe Bool))
-> CreateSolution -> f CreateSolution
createSolution_performHPO = (CreateSolution -> Maybe Bool)
-> (CreateSolution -> Maybe Bool -> CreateSolution)
-> Lens CreateSolution CreateSolution (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolution' {Maybe Bool
performHPO :: Maybe Bool
$sel:performHPO:CreateSolution' :: CreateSolution -> Maybe Bool
performHPO} -> Maybe Bool
performHPO) (\s :: CreateSolution
s@CreateSolution' {} Maybe Bool
a -> CreateSolution
s {$sel:performHPO:CreateSolution' :: Maybe Bool
performHPO = Maybe Bool
a} :: CreateSolution)

-- | The name for the solution.
createSolution_name :: Lens.Lens' CreateSolution Prelude.Text
createSolution_name :: (Text -> f Text) -> CreateSolution -> f CreateSolution
createSolution_name = (CreateSolution -> Text)
-> (CreateSolution -> Text -> CreateSolution)
-> Lens CreateSolution CreateSolution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolution' {Text
name :: Text
$sel:name:CreateSolution' :: CreateSolution -> Text
name} -> Text
name) (\s :: CreateSolution
s@CreateSolution' {} Text
a -> CreateSolution
s {$sel:name:CreateSolution' :: Text
name = Text
a} :: CreateSolution)

-- | The Amazon Resource Name (ARN) of the dataset group that provides the
-- training data.
createSolution_datasetGroupArn :: Lens.Lens' CreateSolution Prelude.Text
createSolution_datasetGroupArn :: (Text -> f Text) -> CreateSolution -> f CreateSolution
createSolution_datasetGroupArn = (CreateSolution -> Text)
-> (CreateSolution -> Text -> CreateSolution)
-> Lens CreateSolution CreateSolution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolution' {Text
datasetGroupArn :: Text
$sel:datasetGroupArn:CreateSolution' :: CreateSolution -> Text
datasetGroupArn} -> Text
datasetGroupArn) (\s :: CreateSolution
s@CreateSolution' {} Text
a -> CreateSolution
s {$sel:datasetGroupArn:CreateSolution' :: Text
datasetGroupArn = Text
a} :: CreateSolution)

instance Core.AWSRequest CreateSolution where
  type
    AWSResponse CreateSolution =
      CreateSolutionResponse
  request :: CreateSolution -> Request CreateSolution
request = Service -> CreateSolution -> Request CreateSolution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateSolution
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSolution)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateSolution))
-> Logger
-> Service
-> Proxy CreateSolution
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSolution)))
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 -> CreateSolutionResponse
CreateSolutionResponse'
            (Maybe Text -> Int -> CreateSolutionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateSolutionResponse)
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
"solutionArn")
            Either String (Int -> CreateSolutionResponse)
-> Either String Int -> Either String CreateSolutionResponse
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 CreateSolution

instance Prelude.NFData CreateSolution

instance Core.ToHeaders CreateSolution where
  toHeaders :: CreateSolution -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateSolution -> 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.CreateSolution" ::
                          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 CreateSolution where
  toJSON :: CreateSolution -> Value
toJSON CreateSolution' {Maybe Bool
Maybe Text
Maybe SolutionConfig
Text
datasetGroupArn :: Text
name :: Text
performHPO :: Maybe Bool
solutionConfig :: Maybe SolutionConfig
eventType :: Maybe Text
recipeArn :: Maybe Text
performAutoML :: Maybe Bool
$sel:datasetGroupArn:CreateSolution' :: CreateSolution -> Text
$sel:name:CreateSolution' :: CreateSolution -> Text
$sel:performHPO:CreateSolution' :: CreateSolution -> Maybe Bool
$sel:solutionConfig:CreateSolution' :: CreateSolution -> Maybe SolutionConfig
$sel:eventType:CreateSolution' :: CreateSolution -> Maybe Text
$sel:recipeArn:CreateSolution' :: CreateSolution -> Maybe Text
$sel:performAutoML:CreateSolution' :: CreateSolution -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"performAutoML" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
performAutoML,
            (Text
"recipeArn" 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
recipeArn,
            (Text
"eventType" 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
eventType,
            (Text
"solutionConfig" Text -> SolutionConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SolutionConfig -> Pair) -> Maybe SolutionConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SolutionConfig
solutionConfig,
            (Text
"performHPO" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
performHPO,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"datasetGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetGroupArn)
          ]
      )

instance Core.ToPath CreateSolution where
  toPath :: CreateSolution -> ByteString
toPath = ByteString -> CreateSolution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateSolution where
  toQuery :: CreateSolution -> QueryString
toQuery = QueryString -> CreateSolution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateSolutionResponse' smart constructor.
data CreateSolutionResponse = CreateSolutionResponse'
  { -- | The ARN of the solution.
    CreateSolutionResponse -> Maybe Text
solutionArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateSolutionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateSolutionResponse -> CreateSolutionResponse -> Bool
(CreateSolutionResponse -> CreateSolutionResponse -> Bool)
-> (CreateSolutionResponse -> CreateSolutionResponse -> Bool)
-> Eq CreateSolutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSolutionResponse -> CreateSolutionResponse -> Bool
$c/= :: CreateSolutionResponse -> CreateSolutionResponse -> Bool
== :: CreateSolutionResponse -> CreateSolutionResponse -> Bool
$c== :: CreateSolutionResponse -> CreateSolutionResponse -> Bool
Prelude.Eq, ReadPrec [CreateSolutionResponse]
ReadPrec CreateSolutionResponse
Int -> ReadS CreateSolutionResponse
ReadS [CreateSolutionResponse]
(Int -> ReadS CreateSolutionResponse)
-> ReadS [CreateSolutionResponse]
-> ReadPrec CreateSolutionResponse
-> ReadPrec [CreateSolutionResponse]
-> Read CreateSolutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSolutionResponse]
$creadListPrec :: ReadPrec [CreateSolutionResponse]
readPrec :: ReadPrec CreateSolutionResponse
$creadPrec :: ReadPrec CreateSolutionResponse
readList :: ReadS [CreateSolutionResponse]
$creadList :: ReadS [CreateSolutionResponse]
readsPrec :: Int -> ReadS CreateSolutionResponse
$creadsPrec :: Int -> ReadS CreateSolutionResponse
Prelude.Read, Int -> CreateSolutionResponse -> ShowS
[CreateSolutionResponse] -> ShowS
CreateSolutionResponse -> String
(Int -> CreateSolutionResponse -> ShowS)
-> (CreateSolutionResponse -> String)
-> ([CreateSolutionResponse] -> ShowS)
-> Show CreateSolutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSolutionResponse] -> ShowS
$cshowList :: [CreateSolutionResponse] -> ShowS
show :: CreateSolutionResponse -> String
$cshow :: CreateSolutionResponse -> String
showsPrec :: Int -> CreateSolutionResponse -> ShowS
$cshowsPrec :: Int -> CreateSolutionResponse -> ShowS
Prelude.Show, (forall x. CreateSolutionResponse -> Rep CreateSolutionResponse x)
-> (forall x.
    Rep CreateSolutionResponse x -> CreateSolutionResponse)
-> Generic CreateSolutionResponse
forall x. Rep CreateSolutionResponse x -> CreateSolutionResponse
forall x. CreateSolutionResponse -> Rep CreateSolutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSolutionResponse x -> CreateSolutionResponse
$cfrom :: forall x. CreateSolutionResponse -> Rep CreateSolutionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateSolutionResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'solutionArn', 'createSolutionResponse_solutionArn' - The ARN of the solution.
--
-- 'httpStatus', 'createSolutionResponse_httpStatus' - The response's http status code.
newCreateSolutionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateSolutionResponse
newCreateSolutionResponse :: Int -> CreateSolutionResponse
newCreateSolutionResponse Int
pHttpStatus_ =
  CreateSolutionResponse' :: Maybe Text -> Int -> CreateSolutionResponse
CreateSolutionResponse'
    { $sel:solutionArn:CreateSolutionResponse' :: Maybe Text
solutionArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateSolutionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the solution.
createSolutionResponse_solutionArn :: Lens.Lens' CreateSolutionResponse (Prelude.Maybe Prelude.Text)
createSolutionResponse_solutionArn :: (Maybe Text -> f (Maybe Text))
-> CreateSolutionResponse -> f CreateSolutionResponse
createSolutionResponse_solutionArn = (CreateSolutionResponse -> Maybe Text)
-> (CreateSolutionResponse -> Maybe Text -> CreateSolutionResponse)
-> Lens
     CreateSolutionResponse
     CreateSolutionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolutionResponse' {Maybe Text
solutionArn :: Maybe Text
$sel:solutionArn:CreateSolutionResponse' :: CreateSolutionResponse -> Maybe Text
solutionArn} -> Maybe Text
solutionArn) (\s :: CreateSolutionResponse
s@CreateSolutionResponse' {} Maybe Text
a -> CreateSolutionResponse
s {$sel:solutionArn:CreateSolutionResponse' :: Maybe Text
solutionArn = Maybe Text
a} :: CreateSolutionResponse)

-- | The response's http status code.
createSolutionResponse_httpStatus :: Lens.Lens' CreateSolutionResponse Prelude.Int
createSolutionResponse_httpStatus :: (Int -> f Int)
-> CreateSolutionResponse -> f CreateSolutionResponse
createSolutionResponse_httpStatus = (CreateSolutionResponse -> Int)
-> (CreateSolutionResponse -> Int -> CreateSolutionResponse)
-> Lens CreateSolutionResponse CreateSolutionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSolutionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSolutionResponse' :: CreateSolutionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSolutionResponse
s@CreateSolutionResponse' {} Int
a -> CreateSolutionResponse
s {$sel:httpStatus:CreateSolutionResponse' :: Int
httpStatus = Int
a} :: CreateSolutionResponse)

instance Prelude.NFData CreateSolutionResponse