{-# 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.ComputeOptimizer.GetRecommendationPreferences
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns existing recommendation preferences, such as enhanced
-- infrastructure metrics.
--
-- Use the @scope@ parameter to specify which preferences to return. You
-- can specify to return preferences for an organization, a specific
-- account ID, or a specific EC2 instance or Auto Scaling group Amazon
-- Resource Name (ARN).
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
--
-- This operation returns paginated results.
module Amazonka.ComputeOptimizer.GetRecommendationPreferences
  ( -- * Creating a Request
    GetRecommendationPreferences (..),
    newGetRecommendationPreferences,

    -- * Request Lenses
    getRecommendationPreferences_maxResults,
    getRecommendationPreferences_nextToken,
    getRecommendationPreferences_scope,
    getRecommendationPreferences_resourceType,

    -- * Destructuring the Response
    GetRecommendationPreferencesResponse (..),
    newGetRecommendationPreferencesResponse,

    -- * Response Lenses
    getRecommendationPreferencesResponse_nextToken,
    getRecommendationPreferencesResponse_recommendationPreferencesDetails,
    getRecommendationPreferencesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetRecommendationPreferences' smart constructor.
data GetRecommendationPreferences = GetRecommendationPreferences'
  { -- | The maximum number of recommendation preferences to return with a single
    -- request.
    --
    -- To retrieve the remaining results, make another request with the
    -- returned @nextToken@ value.
    GetRecommendationPreferences -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token to advance to the next page of recommendation preferences.
    GetRecommendationPreferences -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An object that describes the scope of the recommendation preference to
    -- return.
    --
    -- You can return recommendation preferences that are created at the
    -- organization level (for management accounts of an organization only),
    -- account level, and resource level. For more information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
    -- in the /Compute Optimizer User Guide/.
    GetRecommendationPreferences -> Maybe Scope
scope :: Prelude.Maybe Scope,
    -- | The target resource type of the recommendation preference for which to
    -- return preferences.
    --
    -- The @Ec2Instance@ option encompasses standalone instances and instances
    -- that are part of Auto Scaling groups. The @AutoScalingGroup@ option
    -- encompasses only instances that are part of an Auto Scaling group.
    --
    -- The valid values for this parameter are @Ec2Instance@ and
    -- @AutoScalingGroup@.
    GetRecommendationPreferences -> ResourceType
resourceType :: ResourceType
  }
  deriving (GetRecommendationPreferences
-> GetRecommendationPreferences -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecommendationPreferences
-> GetRecommendationPreferences -> Bool
$c/= :: GetRecommendationPreferences
-> GetRecommendationPreferences -> Bool
== :: GetRecommendationPreferences
-> GetRecommendationPreferences -> Bool
$c== :: GetRecommendationPreferences
-> GetRecommendationPreferences -> Bool
Prelude.Eq, ReadPrec [GetRecommendationPreferences]
ReadPrec GetRecommendationPreferences
Int -> ReadS GetRecommendationPreferences
ReadS [GetRecommendationPreferences]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecommendationPreferences]
$creadListPrec :: ReadPrec [GetRecommendationPreferences]
readPrec :: ReadPrec GetRecommendationPreferences
$creadPrec :: ReadPrec GetRecommendationPreferences
readList :: ReadS [GetRecommendationPreferences]
$creadList :: ReadS [GetRecommendationPreferences]
readsPrec :: Int -> ReadS GetRecommendationPreferences
$creadsPrec :: Int -> ReadS GetRecommendationPreferences
Prelude.Read, Int -> GetRecommendationPreferences -> ShowS
[GetRecommendationPreferences] -> ShowS
GetRecommendationPreferences -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecommendationPreferences] -> ShowS
$cshowList :: [GetRecommendationPreferences] -> ShowS
show :: GetRecommendationPreferences -> String
$cshow :: GetRecommendationPreferences -> String
showsPrec :: Int -> GetRecommendationPreferences -> ShowS
$cshowsPrec :: Int -> GetRecommendationPreferences -> ShowS
Prelude.Show, forall x.
Rep GetRecommendationPreferences x -> GetRecommendationPreferences
forall x.
GetRecommendationPreferences -> Rep GetRecommendationPreferences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRecommendationPreferences x -> GetRecommendationPreferences
$cfrom :: forall x.
GetRecommendationPreferences -> Rep GetRecommendationPreferences x
Prelude.Generic)

-- |
-- Create a value of 'GetRecommendationPreferences' 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:
--
-- 'maxResults', 'getRecommendationPreferences_maxResults' - The maximum number of recommendation preferences to return with a single
-- request.
--
-- To retrieve the remaining results, make another request with the
-- returned @nextToken@ value.
--
-- 'nextToken', 'getRecommendationPreferences_nextToken' - The token to advance to the next page of recommendation preferences.
--
-- 'scope', 'getRecommendationPreferences_scope' - An object that describes the scope of the recommendation preference to
-- return.
--
-- You can return recommendation preferences that are created at the
-- organization level (for management accounts of an organization only),
-- account level, and resource level. For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
--
-- 'resourceType', 'getRecommendationPreferences_resourceType' - The target resource type of the recommendation preference for which to
-- return preferences.
--
-- The @Ec2Instance@ option encompasses standalone instances and instances
-- that are part of Auto Scaling groups. The @AutoScalingGroup@ option
-- encompasses only instances that are part of an Auto Scaling group.
--
-- The valid values for this parameter are @Ec2Instance@ and
-- @AutoScalingGroup@.
newGetRecommendationPreferences ::
  -- | 'resourceType'
  ResourceType ->
  GetRecommendationPreferences
newGetRecommendationPreferences :: ResourceType -> GetRecommendationPreferences
newGetRecommendationPreferences ResourceType
pResourceType_ =
  GetRecommendationPreferences'
    { $sel:maxResults:GetRecommendationPreferences' :: Maybe Natural
maxResults =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetRecommendationPreferences' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:scope:GetRecommendationPreferences' :: Maybe Scope
scope = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:GetRecommendationPreferences' :: ResourceType
resourceType = ResourceType
pResourceType_
    }

-- | The maximum number of recommendation preferences to return with a single
-- request.
--
-- To retrieve the remaining results, make another request with the
-- returned @nextToken@ value.
getRecommendationPreferences_maxResults :: Lens.Lens' GetRecommendationPreferences (Prelude.Maybe Prelude.Natural)
getRecommendationPreferences_maxResults :: Lens' GetRecommendationPreferences (Maybe Natural)
getRecommendationPreferences_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationPreferences' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetRecommendationPreferences
s@GetRecommendationPreferences' {} Maybe Natural
a -> GetRecommendationPreferences
s {$sel:maxResults:GetRecommendationPreferences' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetRecommendationPreferences)

-- | The token to advance to the next page of recommendation preferences.
getRecommendationPreferences_nextToken :: Lens.Lens' GetRecommendationPreferences (Prelude.Maybe Prelude.Text)
getRecommendationPreferences_nextToken :: Lens' GetRecommendationPreferences (Maybe Text)
getRecommendationPreferences_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationPreferences' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetRecommendationPreferences
s@GetRecommendationPreferences' {} Maybe Text
a -> GetRecommendationPreferences
s {$sel:nextToken:GetRecommendationPreferences' :: Maybe Text
nextToken = Maybe Text
a} :: GetRecommendationPreferences)

-- | An object that describes the scope of the recommendation preference to
-- return.
--
-- You can return recommendation preferences that are created at the
-- organization level (for management accounts of an organization only),
-- account level, and resource level. For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
getRecommendationPreferences_scope :: Lens.Lens' GetRecommendationPreferences (Prelude.Maybe Scope)
getRecommendationPreferences_scope :: Lens' GetRecommendationPreferences (Maybe Scope)
getRecommendationPreferences_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationPreferences' {Maybe Scope
scope :: Maybe Scope
$sel:scope:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Scope
scope} -> Maybe Scope
scope) (\s :: GetRecommendationPreferences
s@GetRecommendationPreferences' {} Maybe Scope
a -> GetRecommendationPreferences
s {$sel:scope:GetRecommendationPreferences' :: Maybe Scope
scope = Maybe Scope
a} :: GetRecommendationPreferences)

-- | The target resource type of the recommendation preference for which to
-- return preferences.
--
-- The @Ec2Instance@ option encompasses standalone instances and instances
-- that are part of Auto Scaling groups. The @AutoScalingGroup@ option
-- encompasses only instances that are part of an Auto Scaling group.
--
-- The valid values for this parameter are @Ec2Instance@ and
-- @AutoScalingGroup@.
getRecommendationPreferences_resourceType :: Lens.Lens' GetRecommendationPreferences ResourceType
getRecommendationPreferences_resourceType :: Lens' GetRecommendationPreferences ResourceType
getRecommendationPreferences_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationPreferences' {ResourceType
resourceType :: ResourceType
$sel:resourceType:GetRecommendationPreferences' :: GetRecommendationPreferences -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: GetRecommendationPreferences
s@GetRecommendationPreferences' {} ResourceType
a -> GetRecommendationPreferences
s {$sel:resourceType:GetRecommendationPreferences' :: ResourceType
resourceType = ResourceType
a} :: GetRecommendationPreferences)

instance Core.AWSPager GetRecommendationPreferences where
  page :: GetRecommendationPreferences
-> AWSResponse GetRecommendationPreferences
-> Maybe GetRecommendationPreferences
page GetRecommendationPreferences
rq AWSResponse GetRecommendationPreferences
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetRecommendationPreferences
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetRecommendationPreferencesResponse (Maybe Text)
getRecommendationPreferencesResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetRecommendationPreferences
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  GetRecommendationPreferencesResponse
  (Maybe [RecommendationPreferencesDetail])
getRecommendationPreferencesResponse_recommendationPreferencesDetails
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ GetRecommendationPreferences
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetRecommendationPreferences (Maybe Text)
getRecommendationPreferences_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetRecommendationPreferences
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetRecommendationPreferencesResponse (Maybe Text)
getRecommendationPreferencesResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest GetRecommendationPreferences where
  type
    AWSResponse GetRecommendationPreferences =
      GetRecommendationPreferencesResponse
  request :: (Service -> Service)
-> GetRecommendationPreferences
-> Request GetRecommendationPreferences
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 GetRecommendationPreferences
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRecommendationPreferences)))
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 ->
          Maybe Text
-> Maybe [RecommendationPreferencesDetail]
-> Int
-> GetRecommendationPreferencesResponse
GetRecommendationPreferencesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"recommendationPreferencesDetails"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => 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))
      )

instance
  Prelude.Hashable
    GetRecommendationPreferences
  where
  hashWithSalt :: Int -> GetRecommendationPreferences -> Int
hashWithSalt Int
_salt GetRecommendationPreferences' {Maybe Natural
Maybe Text
Maybe Scope
ResourceType
resourceType :: ResourceType
scope :: Maybe Scope
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:resourceType:GetRecommendationPreferences' :: GetRecommendationPreferences -> ResourceType
$sel:scope:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Scope
$sel:nextToken:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Text
$sel:maxResults:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Scope
scope
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceType
resourceType

instance Prelude.NFData GetRecommendationPreferences where
  rnf :: GetRecommendationPreferences -> ()
rnf GetRecommendationPreferences' {Maybe Natural
Maybe Text
Maybe Scope
ResourceType
resourceType :: ResourceType
scope :: Maybe Scope
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:resourceType:GetRecommendationPreferences' :: GetRecommendationPreferences -> ResourceType
$sel:scope:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Scope
$sel:nextToken:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Text
$sel:maxResults:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Scope
scope
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceType
resourceType

instance Data.ToHeaders GetRecommendationPreferences where
  toHeaders :: GetRecommendationPreferences -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"ComputeOptimizerService.GetRecommendationPreferences" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetRecommendationPreferences where
  toJSON :: GetRecommendationPreferences -> Value
toJSON GetRecommendationPreferences' {Maybe Natural
Maybe Text
Maybe Scope
ResourceType
resourceType :: ResourceType
scope :: Maybe Scope
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:resourceType:GetRecommendationPreferences' :: GetRecommendationPreferences -> ResourceType
$sel:scope:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Scope
$sel:nextToken:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Text
$sel:maxResults:GetRecommendationPreferences' :: GetRecommendationPreferences -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"scope" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Scope
scope,
            forall a. a -> Maybe a
Prelude.Just (Key
"resourceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ResourceType
resourceType)
          ]
      )

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

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

-- | /See:/ 'newGetRecommendationPreferencesResponse' smart constructor.
data GetRecommendationPreferencesResponse = GetRecommendationPreferencesResponse'
  { -- | The token to use to advance to the next page of recommendation
    -- preferences.
    --
    -- This value is null when there are no more pages of recommendation
    -- preferences to return.
    GetRecommendationPreferencesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of objects that describe recommendation preferences.
    GetRecommendationPreferencesResponse
-> Maybe [RecommendationPreferencesDetail]
recommendationPreferencesDetails :: Prelude.Maybe [RecommendationPreferencesDetail],
    -- | The response's http status code.
    GetRecommendationPreferencesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetRecommendationPreferencesResponse
-> GetRecommendationPreferencesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecommendationPreferencesResponse
-> GetRecommendationPreferencesResponse -> Bool
$c/= :: GetRecommendationPreferencesResponse
-> GetRecommendationPreferencesResponse -> Bool
== :: GetRecommendationPreferencesResponse
-> GetRecommendationPreferencesResponse -> Bool
$c== :: GetRecommendationPreferencesResponse
-> GetRecommendationPreferencesResponse -> Bool
Prelude.Eq, ReadPrec [GetRecommendationPreferencesResponse]
ReadPrec GetRecommendationPreferencesResponse
Int -> ReadS GetRecommendationPreferencesResponse
ReadS [GetRecommendationPreferencesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecommendationPreferencesResponse]
$creadListPrec :: ReadPrec [GetRecommendationPreferencesResponse]
readPrec :: ReadPrec GetRecommendationPreferencesResponse
$creadPrec :: ReadPrec GetRecommendationPreferencesResponse
readList :: ReadS [GetRecommendationPreferencesResponse]
$creadList :: ReadS [GetRecommendationPreferencesResponse]
readsPrec :: Int -> ReadS GetRecommendationPreferencesResponse
$creadsPrec :: Int -> ReadS GetRecommendationPreferencesResponse
Prelude.Read, Int -> GetRecommendationPreferencesResponse -> ShowS
[GetRecommendationPreferencesResponse] -> ShowS
GetRecommendationPreferencesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecommendationPreferencesResponse] -> ShowS
$cshowList :: [GetRecommendationPreferencesResponse] -> ShowS
show :: GetRecommendationPreferencesResponse -> String
$cshow :: GetRecommendationPreferencesResponse -> String
showsPrec :: Int -> GetRecommendationPreferencesResponse -> ShowS
$cshowsPrec :: Int -> GetRecommendationPreferencesResponse -> ShowS
Prelude.Show, forall x.
Rep GetRecommendationPreferencesResponse x
-> GetRecommendationPreferencesResponse
forall x.
GetRecommendationPreferencesResponse
-> Rep GetRecommendationPreferencesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRecommendationPreferencesResponse x
-> GetRecommendationPreferencesResponse
$cfrom :: forall x.
GetRecommendationPreferencesResponse
-> Rep GetRecommendationPreferencesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetRecommendationPreferencesResponse' 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', 'getRecommendationPreferencesResponse_nextToken' - The token to use to advance to the next page of recommendation
-- preferences.
--
-- This value is null when there are no more pages of recommendation
-- preferences to return.
--
-- 'recommendationPreferencesDetails', 'getRecommendationPreferencesResponse_recommendationPreferencesDetails' - An array of objects that describe recommendation preferences.
--
-- 'httpStatus', 'getRecommendationPreferencesResponse_httpStatus' - The response's http status code.
newGetRecommendationPreferencesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetRecommendationPreferencesResponse
newGetRecommendationPreferencesResponse :: Int -> GetRecommendationPreferencesResponse
newGetRecommendationPreferencesResponse Int
pHttpStatus_ =
  GetRecommendationPreferencesResponse'
    { $sel:nextToken:GetRecommendationPreferencesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:recommendationPreferencesDetails:GetRecommendationPreferencesResponse' :: Maybe [RecommendationPreferencesDetail]
recommendationPreferencesDetails =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetRecommendationPreferencesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to advance to the next page of recommendation
-- preferences.
--
-- This value is null when there are no more pages of recommendation
-- preferences to return.
getRecommendationPreferencesResponse_nextToken :: Lens.Lens' GetRecommendationPreferencesResponse (Prelude.Maybe Prelude.Text)
getRecommendationPreferencesResponse_nextToken :: Lens' GetRecommendationPreferencesResponse (Maybe Text)
getRecommendationPreferencesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationPreferencesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetRecommendationPreferencesResponse' :: GetRecommendationPreferencesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetRecommendationPreferencesResponse
s@GetRecommendationPreferencesResponse' {} Maybe Text
a -> GetRecommendationPreferencesResponse
s {$sel:nextToken:GetRecommendationPreferencesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetRecommendationPreferencesResponse)

-- | An array of objects that describe recommendation preferences.
getRecommendationPreferencesResponse_recommendationPreferencesDetails :: Lens.Lens' GetRecommendationPreferencesResponse (Prelude.Maybe [RecommendationPreferencesDetail])
getRecommendationPreferencesResponse_recommendationPreferencesDetails :: Lens'
  GetRecommendationPreferencesResponse
  (Maybe [RecommendationPreferencesDetail])
getRecommendationPreferencesResponse_recommendationPreferencesDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationPreferencesResponse' {Maybe [RecommendationPreferencesDetail]
recommendationPreferencesDetails :: Maybe [RecommendationPreferencesDetail]
$sel:recommendationPreferencesDetails:GetRecommendationPreferencesResponse' :: GetRecommendationPreferencesResponse
-> Maybe [RecommendationPreferencesDetail]
recommendationPreferencesDetails} -> Maybe [RecommendationPreferencesDetail]
recommendationPreferencesDetails) (\s :: GetRecommendationPreferencesResponse
s@GetRecommendationPreferencesResponse' {} Maybe [RecommendationPreferencesDetail]
a -> GetRecommendationPreferencesResponse
s {$sel:recommendationPreferencesDetails:GetRecommendationPreferencesResponse' :: Maybe [RecommendationPreferencesDetail]
recommendationPreferencesDetails = Maybe [RecommendationPreferencesDetail]
a} :: GetRecommendationPreferencesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetRecommendationPreferencesResponse
  where
  rnf :: GetRecommendationPreferencesResponse -> ()
rnf GetRecommendationPreferencesResponse' {Int
Maybe [RecommendationPreferencesDetail]
Maybe Text
httpStatus :: Int
recommendationPreferencesDetails :: Maybe [RecommendationPreferencesDetail]
nextToken :: Maybe Text
$sel:httpStatus:GetRecommendationPreferencesResponse' :: GetRecommendationPreferencesResponse -> Int
$sel:recommendationPreferencesDetails:GetRecommendationPreferencesResponse' :: GetRecommendationPreferencesResponse
-> Maybe [RecommendationPreferencesDetail]
$sel:nextToken:GetRecommendationPreferencesResponse' :: GetRecommendationPreferencesResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [RecommendationPreferencesDetail]
recommendationPreferencesDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus