{-# 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.DevOpsGuru.ListRecommendations
-- 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)
--
-- Returns a list of a specified insight\'s recommendations. Each
-- recommendation includes a list of related metrics and a list of related
-- events.
--
-- This operation returns paginated results.
module Amazonka.DevOpsGuru.ListRecommendations
  ( -- * Creating a Request
    ListRecommendations (..),
    newListRecommendations,

    -- * Request Lenses
    listRecommendations_locale,
    listRecommendations_nextToken,
    listRecommendations_insightId,

    -- * Destructuring the Response
    ListRecommendationsResponse (..),
    newListRecommendationsResponse,

    -- * Response Lenses
    listRecommendationsResponse_nextToken,
    listRecommendationsResponse_recommendations,
    listRecommendationsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListRecommendations' smart constructor.
data ListRecommendations = ListRecommendations'
  { -- | A locale that specifies the language to use for recommendations.
    ListRecommendations -> Maybe Locale
locale :: Prelude.Maybe Locale,
    -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If this value is null, it retrieves the first page.
    ListRecommendations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the requested insight.
    ListRecommendations -> Text
insightId :: Prelude.Text
  }
  deriving (ListRecommendations -> ListRecommendations -> Bool
(ListRecommendations -> ListRecommendations -> Bool)
-> (ListRecommendations -> ListRecommendations -> Bool)
-> Eq ListRecommendations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRecommendations -> ListRecommendations -> Bool
$c/= :: ListRecommendations -> ListRecommendations -> Bool
== :: ListRecommendations -> ListRecommendations -> Bool
$c== :: ListRecommendations -> ListRecommendations -> Bool
Prelude.Eq, ReadPrec [ListRecommendations]
ReadPrec ListRecommendations
Int -> ReadS ListRecommendations
ReadS [ListRecommendations]
(Int -> ReadS ListRecommendations)
-> ReadS [ListRecommendations]
-> ReadPrec ListRecommendations
-> ReadPrec [ListRecommendations]
-> Read ListRecommendations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRecommendations]
$creadListPrec :: ReadPrec [ListRecommendations]
readPrec :: ReadPrec ListRecommendations
$creadPrec :: ReadPrec ListRecommendations
readList :: ReadS [ListRecommendations]
$creadList :: ReadS [ListRecommendations]
readsPrec :: Int -> ReadS ListRecommendations
$creadsPrec :: Int -> ReadS ListRecommendations
Prelude.Read, Int -> ListRecommendations -> ShowS
[ListRecommendations] -> ShowS
ListRecommendations -> String
(Int -> ListRecommendations -> ShowS)
-> (ListRecommendations -> String)
-> ([ListRecommendations] -> ShowS)
-> Show ListRecommendations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRecommendations] -> ShowS
$cshowList :: [ListRecommendations] -> ShowS
show :: ListRecommendations -> String
$cshow :: ListRecommendations -> String
showsPrec :: Int -> ListRecommendations -> ShowS
$cshowsPrec :: Int -> ListRecommendations -> ShowS
Prelude.Show, (forall x. ListRecommendations -> Rep ListRecommendations x)
-> (forall x. Rep ListRecommendations x -> ListRecommendations)
-> Generic ListRecommendations
forall x. Rep ListRecommendations x -> ListRecommendations
forall x. ListRecommendations -> Rep ListRecommendations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRecommendations x -> ListRecommendations
$cfrom :: forall x. ListRecommendations -> Rep ListRecommendations x
Prelude.Generic)

-- |
-- Create a value of 'ListRecommendations' 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:
--
-- 'locale', 'listRecommendations_locale' - A locale that specifies the language to use for recommendations.
--
-- 'nextToken', 'listRecommendations_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
--
-- 'insightId', 'listRecommendations_insightId' - The ID of the requested insight.
newListRecommendations ::
  -- | 'insightId'
  Prelude.Text ->
  ListRecommendations
newListRecommendations :: Text -> ListRecommendations
newListRecommendations Text
pInsightId_ =
  ListRecommendations' :: Maybe Locale -> Maybe Text -> Text -> ListRecommendations
ListRecommendations'
    { $sel:locale:ListRecommendations' :: Maybe Locale
locale = Maybe Locale
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListRecommendations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:insightId:ListRecommendations' :: Text
insightId = Text
pInsightId_
    }

-- | A locale that specifies the language to use for recommendations.
listRecommendations_locale :: Lens.Lens' ListRecommendations (Prelude.Maybe Locale)
listRecommendations_locale :: (Maybe Locale -> f (Maybe Locale))
-> ListRecommendations -> f ListRecommendations
listRecommendations_locale = (ListRecommendations -> Maybe Locale)
-> (ListRecommendations -> Maybe Locale -> ListRecommendations)
-> Lens
     ListRecommendations
     ListRecommendations
     (Maybe Locale)
     (Maybe Locale)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecommendations' {Maybe Locale
locale :: Maybe Locale
$sel:locale:ListRecommendations' :: ListRecommendations -> Maybe Locale
locale} -> Maybe Locale
locale) (\s :: ListRecommendations
s@ListRecommendations' {} Maybe Locale
a -> ListRecommendations
s {$sel:locale:ListRecommendations' :: Maybe Locale
locale = Maybe Locale
a} :: ListRecommendations)

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
listRecommendations_nextToken :: Lens.Lens' ListRecommendations (Prelude.Maybe Prelude.Text)
listRecommendations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRecommendations -> f ListRecommendations
listRecommendations_nextToken = (ListRecommendations -> Maybe Text)
-> (ListRecommendations -> Maybe Text -> ListRecommendations)
-> Lens
     ListRecommendations ListRecommendations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecommendations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRecommendations' :: ListRecommendations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRecommendations
s@ListRecommendations' {} Maybe Text
a -> ListRecommendations
s {$sel:nextToken:ListRecommendations' :: Maybe Text
nextToken = Maybe Text
a} :: ListRecommendations)

-- | The ID of the requested insight.
listRecommendations_insightId :: Lens.Lens' ListRecommendations Prelude.Text
listRecommendations_insightId :: (Text -> f Text) -> ListRecommendations -> f ListRecommendations
listRecommendations_insightId = (ListRecommendations -> Text)
-> (ListRecommendations -> Text -> ListRecommendations)
-> Lens ListRecommendations ListRecommendations Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecommendations' {Text
insightId :: Text
$sel:insightId:ListRecommendations' :: ListRecommendations -> Text
insightId} -> Text
insightId) (\s :: ListRecommendations
s@ListRecommendations' {} Text
a -> ListRecommendations
s {$sel:insightId:ListRecommendations' :: Text
insightId = Text
a} :: ListRecommendations)

instance Core.AWSPager ListRecommendations where
  page :: ListRecommendations
-> AWSResponse ListRecommendations -> Maybe ListRecommendations
page ListRecommendations
rq AWSResponse ListRecommendations
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRecommendations
ListRecommendationsResponse
rs
            ListRecommendationsResponse
-> Getting (First Text) ListRecommendationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRecommendationsResponse
-> Const (First Text) ListRecommendationsResponse
Lens' ListRecommendationsResponse (Maybe Text)
listRecommendationsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRecommendationsResponse
 -> Const (First Text) ListRecommendationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRecommendationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRecommendations
forall a. Maybe a
Prelude.Nothing
    | Maybe [Recommendation] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRecommendations
ListRecommendationsResponse
rs
            ListRecommendationsResponse
-> Getting
     (First [Recommendation])
     ListRecommendationsResponse
     [Recommendation]
-> Maybe [Recommendation]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Recommendation]
 -> Const (First [Recommendation]) (Maybe [Recommendation]))
-> ListRecommendationsResponse
-> Const (First [Recommendation]) ListRecommendationsResponse
Lens' ListRecommendationsResponse (Maybe [Recommendation])
listRecommendationsResponse_recommendations
              ((Maybe [Recommendation]
  -> Const (First [Recommendation]) (Maybe [Recommendation]))
 -> ListRecommendationsResponse
 -> Const (First [Recommendation]) ListRecommendationsResponse)
-> (([Recommendation]
     -> Const (First [Recommendation]) [Recommendation])
    -> Maybe [Recommendation]
    -> Const (First [Recommendation]) (Maybe [Recommendation]))
-> Getting
     (First [Recommendation])
     ListRecommendationsResponse
     [Recommendation]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Recommendation]
 -> Const (First [Recommendation]) [Recommendation])
-> Maybe [Recommendation]
-> Const (First [Recommendation]) (Maybe [Recommendation])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRecommendations
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListRecommendations -> Maybe ListRecommendations
forall a. a -> Maybe a
Prelude.Just (ListRecommendations -> Maybe ListRecommendations)
-> ListRecommendations -> Maybe ListRecommendations
forall a b. (a -> b) -> a -> b
Prelude.$
        ListRecommendations
rq
          ListRecommendations
-> (ListRecommendations -> ListRecommendations)
-> ListRecommendations
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListRecommendations -> Identity ListRecommendations
Lens
  ListRecommendations ListRecommendations (Maybe Text) (Maybe Text)
listRecommendations_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListRecommendations -> Identity ListRecommendations)
-> Maybe Text -> ListRecommendations -> ListRecommendations
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRecommendations
ListRecommendationsResponse
rs
          ListRecommendationsResponse
-> Getting (First Text) ListRecommendationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRecommendationsResponse
-> Const (First Text) ListRecommendationsResponse
Lens' ListRecommendationsResponse (Maybe Text)
listRecommendationsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRecommendationsResponse
 -> Const (First Text) ListRecommendationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRecommendationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListRecommendations where
  type
    AWSResponse ListRecommendations =
      ListRecommendationsResponse
  request :: ListRecommendations -> Request ListRecommendations
request = Service -> ListRecommendations -> Request ListRecommendations
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListRecommendations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRecommendations)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListRecommendations))
-> Logger
-> Service
-> Proxy ListRecommendations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRecommendations)))
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
-> Maybe [Recommendation] -> Int -> ListRecommendationsResponse
ListRecommendationsResponse'
            (Maybe Text
 -> Maybe [Recommendation] -> Int -> ListRecommendationsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [Recommendation] -> Int -> ListRecommendationsResponse)
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
"NextToken")
            Either
  String
  (Maybe [Recommendation] -> Int -> ListRecommendationsResponse)
-> Either String (Maybe [Recommendation])
-> Either String (Int -> ListRecommendationsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [Recommendation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Recommendations"
                            Either String (Maybe (Maybe [Recommendation]))
-> Maybe [Recommendation] -> Either String (Maybe [Recommendation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Recommendation]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> ListRecommendationsResponse)
-> Either String Int -> Either String ListRecommendationsResponse
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 ListRecommendations

instance Prelude.NFData ListRecommendations

instance Core.ToHeaders ListRecommendations where
  toHeaders :: ListRecommendations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListRecommendations -> 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.ToJSON ListRecommendations where
  toJSON :: ListRecommendations -> Value
toJSON ListRecommendations' {Maybe Text
Maybe Locale
Text
insightId :: Text
nextToken :: Maybe Text
locale :: Maybe Locale
$sel:insightId:ListRecommendations' :: ListRecommendations -> Text
$sel:nextToken:ListRecommendations' :: ListRecommendations -> Maybe Text
$sel:locale:ListRecommendations' :: ListRecommendations -> Maybe Locale
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Locale" Text -> Locale -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Locale -> Pair) -> Maybe Locale -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Locale
locale,
            (Text
"NextToken" 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
nextToken,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InsightId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
insightId)
          ]
      )

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

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

-- | /See:/ 'newListRecommendationsResponse' smart constructor.
data ListRecommendationsResponse = ListRecommendationsResponse'
  { -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If there are no more pages, this value is null.
    ListRecommendationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of the requested recommendations.
    ListRecommendationsResponse -> Maybe [Recommendation]
recommendations :: Prelude.Maybe [Recommendation],
    -- | The response's http status code.
    ListRecommendationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListRecommendationsResponse -> ListRecommendationsResponse -> Bool
(ListRecommendationsResponse
 -> ListRecommendationsResponse -> Bool)
-> (ListRecommendationsResponse
    -> ListRecommendationsResponse -> Bool)
-> Eq ListRecommendationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRecommendationsResponse -> ListRecommendationsResponse -> Bool
$c/= :: ListRecommendationsResponse -> ListRecommendationsResponse -> Bool
== :: ListRecommendationsResponse -> ListRecommendationsResponse -> Bool
$c== :: ListRecommendationsResponse -> ListRecommendationsResponse -> Bool
Prelude.Eq, ReadPrec [ListRecommendationsResponse]
ReadPrec ListRecommendationsResponse
Int -> ReadS ListRecommendationsResponse
ReadS [ListRecommendationsResponse]
(Int -> ReadS ListRecommendationsResponse)
-> ReadS [ListRecommendationsResponse]
-> ReadPrec ListRecommendationsResponse
-> ReadPrec [ListRecommendationsResponse]
-> Read ListRecommendationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRecommendationsResponse]
$creadListPrec :: ReadPrec [ListRecommendationsResponse]
readPrec :: ReadPrec ListRecommendationsResponse
$creadPrec :: ReadPrec ListRecommendationsResponse
readList :: ReadS [ListRecommendationsResponse]
$creadList :: ReadS [ListRecommendationsResponse]
readsPrec :: Int -> ReadS ListRecommendationsResponse
$creadsPrec :: Int -> ReadS ListRecommendationsResponse
Prelude.Read, Int -> ListRecommendationsResponse -> ShowS
[ListRecommendationsResponse] -> ShowS
ListRecommendationsResponse -> String
(Int -> ListRecommendationsResponse -> ShowS)
-> (ListRecommendationsResponse -> String)
-> ([ListRecommendationsResponse] -> ShowS)
-> Show ListRecommendationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRecommendationsResponse] -> ShowS
$cshowList :: [ListRecommendationsResponse] -> ShowS
show :: ListRecommendationsResponse -> String
$cshow :: ListRecommendationsResponse -> String
showsPrec :: Int -> ListRecommendationsResponse -> ShowS
$cshowsPrec :: Int -> ListRecommendationsResponse -> ShowS
Prelude.Show, (forall x.
 ListRecommendationsResponse -> Rep ListRecommendationsResponse x)
-> (forall x.
    Rep ListRecommendationsResponse x -> ListRecommendationsResponse)
-> Generic ListRecommendationsResponse
forall x.
Rep ListRecommendationsResponse x -> ListRecommendationsResponse
forall x.
ListRecommendationsResponse -> Rep ListRecommendationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRecommendationsResponse x -> ListRecommendationsResponse
$cfrom :: forall x.
ListRecommendationsResponse -> Rep ListRecommendationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRecommendationsResponse' 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:
--
-- 'nextToken', 'listRecommendationsResponse_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
--
-- 'recommendations', 'listRecommendationsResponse_recommendations' - An array of the requested recommendations.
--
-- 'httpStatus', 'listRecommendationsResponse_httpStatus' - The response's http status code.
newListRecommendationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRecommendationsResponse
newListRecommendationsResponse :: Int -> ListRecommendationsResponse
newListRecommendationsResponse Int
pHttpStatus_ =
  ListRecommendationsResponse' :: Maybe Text
-> Maybe [Recommendation] -> Int -> ListRecommendationsResponse
ListRecommendationsResponse'
    { $sel:nextToken:ListRecommendationsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recommendations:ListRecommendationsResponse' :: Maybe [Recommendation]
recommendations = Maybe [Recommendation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRecommendationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
listRecommendationsResponse_nextToken :: Lens.Lens' ListRecommendationsResponse (Prelude.Maybe Prelude.Text)
listRecommendationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRecommendationsResponse -> f ListRecommendationsResponse
listRecommendationsResponse_nextToken = (ListRecommendationsResponse -> Maybe Text)
-> (ListRecommendationsResponse
    -> Maybe Text -> ListRecommendationsResponse)
-> Lens' ListRecommendationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecommendationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRecommendationsResponse' :: ListRecommendationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRecommendationsResponse
s@ListRecommendationsResponse' {} Maybe Text
a -> ListRecommendationsResponse
s {$sel:nextToken:ListRecommendationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListRecommendationsResponse)

-- | An array of the requested recommendations.
listRecommendationsResponse_recommendations :: Lens.Lens' ListRecommendationsResponse (Prelude.Maybe [Recommendation])
listRecommendationsResponse_recommendations :: (Maybe [Recommendation] -> f (Maybe [Recommendation]))
-> ListRecommendationsResponse -> f ListRecommendationsResponse
listRecommendationsResponse_recommendations = (ListRecommendationsResponse -> Maybe [Recommendation])
-> (ListRecommendationsResponse
    -> Maybe [Recommendation] -> ListRecommendationsResponse)
-> Lens' ListRecommendationsResponse (Maybe [Recommendation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecommendationsResponse' {Maybe [Recommendation]
recommendations :: Maybe [Recommendation]
$sel:recommendations:ListRecommendationsResponse' :: ListRecommendationsResponse -> Maybe [Recommendation]
recommendations} -> Maybe [Recommendation]
recommendations) (\s :: ListRecommendationsResponse
s@ListRecommendationsResponse' {} Maybe [Recommendation]
a -> ListRecommendationsResponse
s {$sel:recommendations:ListRecommendationsResponse' :: Maybe [Recommendation]
recommendations = Maybe [Recommendation]
a} :: ListRecommendationsResponse) ((Maybe [Recommendation] -> f (Maybe [Recommendation]))
 -> ListRecommendationsResponse -> f ListRecommendationsResponse)
-> ((Maybe [Recommendation] -> f (Maybe [Recommendation]))
    -> Maybe [Recommendation] -> f (Maybe [Recommendation]))
-> (Maybe [Recommendation] -> f (Maybe [Recommendation]))
-> ListRecommendationsResponse
-> f ListRecommendationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [Recommendation] [Recommendation] [Recommendation] [Recommendation]
-> Iso
     (Maybe [Recommendation])
     (Maybe [Recommendation])
     (Maybe [Recommendation])
     (Maybe [Recommendation])
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
  [Recommendation] [Recommendation] [Recommendation] [Recommendation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListRecommendationsResponse