{-# 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.GetRecommenderConfiguration
-- 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)
--
-- Retrieves information about an Amazon Pinpoint configuration for a
-- recommender model.
module Amazonka.Pinpoint.GetRecommenderConfiguration
  ( -- * Creating a Request
    GetRecommenderConfiguration (..),
    newGetRecommenderConfiguration,

    -- * Request Lenses
    getRecommenderConfiguration_recommenderId,

    -- * Destructuring the Response
    GetRecommenderConfigurationResponse (..),
    newGetRecommenderConfigurationResponse,

    -- * Response Lenses
    getRecommenderConfigurationResponse_httpStatus,
    getRecommenderConfigurationResponse_recommenderConfigurationResponse,
  )
where

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

-- | /See:/ 'newGetRecommenderConfiguration' smart constructor.
data GetRecommenderConfiguration = GetRecommenderConfiguration'
  { -- | The unique identifier for the recommender model configuration. This
    -- identifier is displayed as the __Recommender ID__ on the Amazon Pinpoint
    -- console.
    GetRecommenderConfiguration -> Text
recommenderId :: Prelude.Text
  }
  deriving (GetRecommenderConfiguration -> GetRecommenderConfiguration -> Bool
(GetRecommenderConfiguration
 -> GetRecommenderConfiguration -> Bool)
-> (GetRecommenderConfiguration
    -> GetRecommenderConfiguration -> Bool)
-> Eq GetRecommenderConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecommenderConfiguration -> GetRecommenderConfiguration -> Bool
$c/= :: GetRecommenderConfiguration -> GetRecommenderConfiguration -> Bool
== :: GetRecommenderConfiguration -> GetRecommenderConfiguration -> Bool
$c== :: GetRecommenderConfiguration -> GetRecommenderConfiguration -> Bool
Prelude.Eq, ReadPrec [GetRecommenderConfiguration]
ReadPrec GetRecommenderConfiguration
Int -> ReadS GetRecommenderConfiguration
ReadS [GetRecommenderConfiguration]
(Int -> ReadS GetRecommenderConfiguration)
-> ReadS [GetRecommenderConfiguration]
-> ReadPrec GetRecommenderConfiguration
-> ReadPrec [GetRecommenderConfiguration]
-> Read GetRecommenderConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecommenderConfiguration]
$creadListPrec :: ReadPrec [GetRecommenderConfiguration]
readPrec :: ReadPrec GetRecommenderConfiguration
$creadPrec :: ReadPrec GetRecommenderConfiguration
readList :: ReadS [GetRecommenderConfiguration]
$creadList :: ReadS [GetRecommenderConfiguration]
readsPrec :: Int -> ReadS GetRecommenderConfiguration
$creadsPrec :: Int -> ReadS GetRecommenderConfiguration
Prelude.Read, Int -> GetRecommenderConfiguration -> ShowS
[GetRecommenderConfiguration] -> ShowS
GetRecommenderConfiguration -> String
(Int -> GetRecommenderConfiguration -> ShowS)
-> (GetRecommenderConfiguration -> String)
-> ([GetRecommenderConfiguration] -> ShowS)
-> Show GetRecommenderConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecommenderConfiguration] -> ShowS
$cshowList :: [GetRecommenderConfiguration] -> ShowS
show :: GetRecommenderConfiguration -> String
$cshow :: GetRecommenderConfiguration -> String
showsPrec :: Int -> GetRecommenderConfiguration -> ShowS
$cshowsPrec :: Int -> GetRecommenderConfiguration -> ShowS
Prelude.Show, (forall x.
 GetRecommenderConfiguration -> Rep GetRecommenderConfiguration x)
-> (forall x.
    Rep GetRecommenderConfiguration x -> GetRecommenderConfiguration)
-> Generic GetRecommenderConfiguration
forall x.
Rep GetRecommenderConfiguration x -> GetRecommenderConfiguration
forall x.
GetRecommenderConfiguration -> Rep GetRecommenderConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRecommenderConfiguration x -> GetRecommenderConfiguration
$cfrom :: forall x.
GetRecommenderConfiguration -> Rep GetRecommenderConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'GetRecommenderConfiguration' 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:
--
-- 'recommenderId', 'getRecommenderConfiguration_recommenderId' - The unique identifier for the recommender model configuration. This
-- identifier is displayed as the __Recommender ID__ on the Amazon Pinpoint
-- console.
newGetRecommenderConfiguration ::
  -- | 'recommenderId'
  Prelude.Text ->
  GetRecommenderConfiguration
newGetRecommenderConfiguration :: Text -> GetRecommenderConfiguration
newGetRecommenderConfiguration Text
pRecommenderId_ =
  GetRecommenderConfiguration' :: Text -> GetRecommenderConfiguration
GetRecommenderConfiguration'
    { $sel:recommenderId:GetRecommenderConfiguration' :: Text
recommenderId =
        Text
pRecommenderId_
    }

-- | The unique identifier for the recommender model configuration. This
-- identifier is displayed as the __Recommender ID__ on the Amazon Pinpoint
-- console.
getRecommenderConfiguration_recommenderId :: Lens.Lens' GetRecommenderConfiguration Prelude.Text
getRecommenderConfiguration_recommenderId :: (Text -> f Text)
-> GetRecommenderConfiguration -> f GetRecommenderConfiguration
getRecommenderConfiguration_recommenderId = (GetRecommenderConfiguration -> Text)
-> (GetRecommenderConfiguration
    -> Text -> GetRecommenderConfiguration)
-> Lens
     GetRecommenderConfiguration GetRecommenderConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommenderConfiguration' {Text
recommenderId :: Text
$sel:recommenderId:GetRecommenderConfiguration' :: GetRecommenderConfiguration -> Text
recommenderId} -> Text
recommenderId) (\s :: GetRecommenderConfiguration
s@GetRecommenderConfiguration' {} Text
a -> GetRecommenderConfiguration
s {$sel:recommenderId:GetRecommenderConfiguration' :: Text
recommenderId = Text
a} :: GetRecommenderConfiguration)

instance Core.AWSRequest GetRecommenderConfiguration where
  type
    AWSResponse GetRecommenderConfiguration =
      GetRecommenderConfigurationResponse
  request :: GetRecommenderConfiguration -> Request GetRecommenderConfiguration
request = Service
-> GetRecommenderConfiguration
-> Request GetRecommenderConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetRecommenderConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRecommenderConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetRecommenderConfiguration))
-> Logger
-> Service
-> Proxy GetRecommenderConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRecommenderConfiguration)))
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 ->
          Int
-> RecommenderConfigurationResponse
-> GetRecommenderConfigurationResponse
GetRecommenderConfigurationResponse'
            (Int
 -> RecommenderConfigurationResponse
 -> GetRecommenderConfigurationResponse)
-> Either String Int
-> Either
     String
     (RecommenderConfigurationResponse
      -> GetRecommenderConfigurationResponse)
forall (f :: * -> *) a b. Functor 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))
            Either
  String
  (RecommenderConfigurationResponse
   -> GetRecommenderConfigurationResponse)
-> Either String RecommenderConfigurationResponse
-> Either String GetRecommenderConfigurationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String RecommenderConfigurationResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable GetRecommenderConfiguration

instance Prelude.NFData GetRecommenderConfiguration

instance Core.ToHeaders GetRecommenderConfiguration where
  toHeaders :: GetRecommenderConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetRecommenderConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetRecommenderConfiguration where
  toPath :: GetRecommenderConfiguration -> ByteString
toPath GetRecommenderConfiguration' {Text
recommenderId :: Text
$sel:recommenderId:GetRecommenderConfiguration' :: GetRecommenderConfiguration -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/recommenders/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
recommenderId]

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

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

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

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

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

instance
  Prelude.NFData
    GetRecommenderConfigurationResponse