{-# 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.Pinpoint.CreateRecommenderConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an Amazon Pinpoint configuration for a recommender model.
module Amazonka.Pinpoint.CreateRecommenderConfiguration
  ( -- * Creating a Request
    CreateRecommenderConfiguration' (..),
    newCreateRecommenderConfiguration',

    -- * Request Lenses
    createRecommenderConfiguration'_createRecommenderConfiguration,

    -- * Destructuring the Response
    CreateRecommenderConfigurationResponse (..),
    newCreateRecommenderConfigurationResponse,

    -- * Response Lenses
    createRecommenderConfigurationResponse_httpStatus,
    createRecommenderConfigurationResponse_recommenderConfigurationResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateRecommenderConfiguration'' smart constructor.
data CreateRecommenderConfiguration' = CreateRecommenderConfiguration''
  { CreateRecommenderConfiguration' -> CreateRecommenderConfiguration
createRecommenderConfiguration :: CreateRecommenderConfiguration
  }
  deriving (CreateRecommenderConfiguration'
-> CreateRecommenderConfiguration' -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRecommenderConfiguration'
-> CreateRecommenderConfiguration' -> Bool
$c/= :: CreateRecommenderConfiguration'
-> CreateRecommenderConfiguration' -> Bool
== :: CreateRecommenderConfiguration'
-> CreateRecommenderConfiguration' -> Bool
$c== :: CreateRecommenderConfiguration'
-> CreateRecommenderConfiguration' -> Bool
Prelude.Eq, ReadPrec [CreateRecommenderConfiguration']
ReadPrec CreateRecommenderConfiguration'
Int -> ReadS CreateRecommenderConfiguration'
ReadS [CreateRecommenderConfiguration']
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRecommenderConfiguration']
$creadListPrec :: ReadPrec [CreateRecommenderConfiguration']
readPrec :: ReadPrec CreateRecommenderConfiguration'
$creadPrec :: ReadPrec CreateRecommenderConfiguration'
readList :: ReadS [CreateRecommenderConfiguration']
$creadList :: ReadS [CreateRecommenderConfiguration']
readsPrec :: Int -> ReadS CreateRecommenderConfiguration'
$creadsPrec :: Int -> ReadS CreateRecommenderConfiguration'
Prelude.Read, Int -> CreateRecommenderConfiguration' -> ShowS
[CreateRecommenderConfiguration'] -> ShowS
CreateRecommenderConfiguration' -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRecommenderConfiguration'] -> ShowS
$cshowList :: [CreateRecommenderConfiguration'] -> ShowS
show :: CreateRecommenderConfiguration' -> String
$cshow :: CreateRecommenderConfiguration' -> String
showsPrec :: Int -> CreateRecommenderConfiguration' -> ShowS
$cshowsPrec :: Int -> CreateRecommenderConfiguration' -> ShowS
Prelude.Show, forall x.
Rep CreateRecommenderConfiguration' x
-> CreateRecommenderConfiguration'
forall x.
CreateRecommenderConfiguration'
-> Rep CreateRecommenderConfiguration' x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRecommenderConfiguration' x
-> CreateRecommenderConfiguration'
$cfrom :: forall x.
CreateRecommenderConfiguration'
-> Rep CreateRecommenderConfiguration' x
Prelude.Generic)

-- |
-- Create a value of 'CreateRecommenderConfiguration'' 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:
--
-- 'createRecommenderConfiguration', 'createRecommenderConfiguration'_createRecommenderConfiguration' - Undocumented member.
newCreateRecommenderConfiguration' ::
  -- | 'createRecommenderConfiguration'
  CreateRecommenderConfiguration ->
  CreateRecommenderConfiguration'
newCreateRecommenderConfiguration' :: CreateRecommenderConfiguration -> CreateRecommenderConfiguration'
newCreateRecommenderConfiguration'
  CreateRecommenderConfiguration
pCreateRecommenderConfiguration_ =
    CreateRecommenderConfiguration''
      { $sel:createRecommenderConfiguration:CreateRecommenderConfiguration'' :: CreateRecommenderConfiguration
createRecommenderConfiguration =
          CreateRecommenderConfiguration
pCreateRecommenderConfiguration_
      }

-- | Undocumented member.
createRecommenderConfiguration'_createRecommenderConfiguration :: Lens.Lens' CreateRecommenderConfiguration' CreateRecommenderConfiguration
createRecommenderConfiguration'_createRecommenderConfiguration :: Lens'
  CreateRecommenderConfiguration' CreateRecommenderConfiguration
createRecommenderConfiguration'_createRecommenderConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRecommenderConfiguration'' {CreateRecommenderConfiguration
createRecommenderConfiguration :: CreateRecommenderConfiguration
$sel:createRecommenderConfiguration:CreateRecommenderConfiguration'' :: CreateRecommenderConfiguration' -> CreateRecommenderConfiguration
createRecommenderConfiguration} -> CreateRecommenderConfiguration
createRecommenderConfiguration) (\s :: CreateRecommenderConfiguration'
s@CreateRecommenderConfiguration'' {} CreateRecommenderConfiguration
a -> CreateRecommenderConfiguration'
s {$sel:createRecommenderConfiguration:CreateRecommenderConfiguration'' :: CreateRecommenderConfiguration
createRecommenderConfiguration = CreateRecommenderConfiguration
a} :: CreateRecommenderConfiguration')

instance
  Core.AWSRequest
    CreateRecommenderConfiguration'
  where
  type
    AWSResponse CreateRecommenderConfiguration' =
      CreateRecommenderConfigurationResponse
  request :: (Service -> Service)
-> CreateRecommenderConfiguration'
-> Request CreateRecommenderConfiguration'
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateRecommenderConfiguration'
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateRecommenderConfiguration')))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int
-> RecommenderConfigurationResponse
-> CreateRecommenderConfigurationResponse
CreateRecommenderConfigurationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
      )

instance
  Prelude.Hashable
    CreateRecommenderConfiguration'
  where
  hashWithSalt :: Int -> CreateRecommenderConfiguration' -> Int
hashWithSalt
    Int
_salt
    CreateRecommenderConfiguration'' {CreateRecommenderConfiguration
createRecommenderConfiguration :: CreateRecommenderConfiguration
$sel:createRecommenderConfiguration:CreateRecommenderConfiguration'' :: CreateRecommenderConfiguration' -> CreateRecommenderConfiguration
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CreateRecommenderConfiguration
createRecommenderConfiguration

instance
  Prelude.NFData
    CreateRecommenderConfiguration'
  where
  rnf :: CreateRecommenderConfiguration' -> ()
rnf CreateRecommenderConfiguration'' {CreateRecommenderConfiguration
createRecommenderConfiguration :: CreateRecommenderConfiguration
$sel:createRecommenderConfiguration:CreateRecommenderConfiguration'' :: CreateRecommenderConfiguration' -> CreateRecommenderConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf CreateRecommenderConfiguration
createRecommenderConfiguration

instance
  Data.ToHeaders
    CreateRecommenderConfiguration'
  where
  toHeaders :: CreateRecommenderConfiguration' -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateRecommenderConfiguration' where
  toJSON :: CreateRecommenderConfiguration' -> Value
toJSON CreateRecommenderConfiguration'' {CreateRecommenderConfiguration
createRecommenderConfiguration :: CreateRecommenderConfiguration
$sel:createRecommenderConfiguration:CreateRecommenderConfiguration'' :: CreateRecommenderConfiguration' -> CreateRecommenderConfiguration
..} =
    forall a. ToJSON a => a -> Value
Data.toJSON CreateRecommenderConfiguration
createRecommenderConfiguration

instance Data.ToPath CreateRecommenderConfiguration' where
  toPath :: CreateRecommenderConfiguration' -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/recommenders"

instance Data.ToQuery CreateRecommenderConfiguration' where
  toQuery :: CreateRecommenderConfiguration' -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

-- |
-- Create a value of 'CreateRecommenderConfigurationResponse' 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:
--
-- 'httpStatus', 'createRecommenderConfigurationResponse_httpStatus' - The response's http status code.
--
-- 'recommenderConfigurationResponse', 'createRecommenderConfigurationResponse_recommenderConfigurationResponse' - Undocumented member.
newCreateRecommenderConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'recommenderConfigurationResponse'
  RecommenderConfigurationResponse ->
  CreateRecommenderConfigurationResponse
newCreateRecommenderConfigurationResponse :: Int
-> RecommenderConfigurationResponse
-> CreateRecommenderConfigurationResponse
newCreateRecommenderConfigurationResponse
  Int
pHttpStatus_
  RecommenderConfigurationResponse
pRecommenderConfigurationResponse_ =
    CreateRecommenderConfigurationResponse'
      { $sel:httpStatus:CreateRecommenderConfigurationResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:recommenderConfigurationResponse:CreateRecommenderConfigurationResponse' :: RecommenderConfigurationResponse
recommenderConfigurationResponse =
          RecommenderConfigurationResponse
pRecommenderConfigurationResponse_
      }

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

-- | Undocumented member.
createRecommenderConfigurationResponse_recommenderConfigurationResponse :: Lens.Lens' CreateRecommenderConfigurationResponse RecommenderConfigurationResponse
createRecommenderConfigurationResponse_recommenderConfigurationResponse :: Lens'
  CreateRecommenderConfigurationResponse
  RecommenderConfigurationResponse
createRecommenderConfigurationResponse_recommenderConfigurationResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRecommenderConfigurationResponse' {RecommenderConfigurationResponse
recommenderConfigurationResponse :: RecommenderConfigurationResponse
$sel:recommenderConfigurationResponse:CreateRecommenderConfigurationResponse' :: CreateRecommenderConfigurationResponse
-> RecommenderConfigurationResponse
recommenderConfigurationResponse} -> RecommenderConfigurationResponse
recommenderConfigurationResponse) (\s :: CreateRecommenderConfigurationResponse
s@CreateRecommenderConfigurationResponse' {} RecommenderConfigurationResponse
a -> CreateRecommenderConfigurationResponse
s {$sel:recommenderConfigurationResponse:CreateRecommenderConfigurationResponse' :: RecommenderConfigurationResponse
recommenderConfigurationResponse = RecommenderConfigurationResponse
a} :: CreateRecommenderConfigurationResponse)

instance
  Prelude.NFData
    CreateRecommenderConfigurationResponse
  where
  rnf :: CreateRecommenderConfigurationResponse -> ()
rnf CreateRecommenderConfigurationResponse' {Int
RecommenderConfigurationResponse
recommenderConfigurationResponse :: RecommenderConfigurationResponse
httpStatus :: Int
$sel:recommenderConfigurationResponse:CreateRecommenderConfigurationResponse' :: CreateRecommenderConfigurationResponse
-> RecommenderConfigurationResponse
$sel:httpStatus:CreateRecommenderConfigurationResponse' :: CreateRecommenderConfigurationResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RecommenderConfigurationResponse
recommenderConfigurationResponse