{-# 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.GetLambdaFunctionRecommendations
-- 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 Lambda function recommendations.
--
-- Compute Optimizer generates recommendations for functions that meet a
-- specific set of requirements. For more information, see the
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/requirements.html Supported resources and requirements>
-- in the /Compute Optimizer User Guide/.
module Amazonka.ComputeOptimizer.GetLambdaFunctionRecommendations
  ( -- * Creating a Request
    GetLambdaFunctionRecommendations (..),
    newGetLambdaFunctionRecommendations,

    -- * Request Lenses
    getLambdaFunctionRecommendations_functionArns,
    getLambdaFunctionRecommendations_accountIds,
    getLambdaFunctionRecommendations_filters,
    getLambdaFunctionRecommendations_nextToken,
    getLambdaFunctionRecommendations_maxResults,

    -- * Destructuring the Response
    GetLambdaFunctionRecommendationsResponse (..),
    newGetLambdaFunctionRecommendationsResponse,

    -- * Response Lenses
    getLambdaFunctionRecommendationsResponse_nextToken,
    getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations,
    getLambdaFunctionRecommendationsResponse_httpStatus,
  )
where

import Amazonka.ComputeOptimizer.Types
import qualified Amazonka.Core as Core
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:/ 'newGetLambdaFunctionRecommendations' smart constructor.
data GetLambdaFunctionRecommendations = GetLambdaFunctionRecommendations'
  { -- | The Amazon Resource Name (ARN) of the functions for which to return
    -- recommendations.
    --
    -- You can specify a qualified or unqualified ARN. If you specify an
    -- unqualified ARN without a function version suffix, Compute Optimizer
    -- will return recommendations for the latest (@$LATEST@) version of the
    -- function. If you specify a qualified ARN with a version suffix, Compute
    -- Optimizer will return recommendations for the specified function
    -- version. For more information about using function versions, see
    -- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html#versioning-versions-using Using versions>
    -- in the /Lambda Developer Guide/.
    GetLambdaFunctionRecommendations -> Maybe [Text]
functionArns :: Prelude.Maybe [Prelude.Text],
    -- | The ID of the Amazon Web Services account for which to return function
    -- recommendations.
    --
    -- If your account is the management account of an organization, use this
    -- parameter to specify the member account for which you want to return
    -- function recommendations.
    --
    -- Only one account ID can be specified per request.
    GetLambdaFunctionRecommendations -> Maybe [Text]
accountIds :: Prelude.Maybe [Prelude.Text],
    -- | An array of objects to specify a filter that returns a more specific
    -- list of function recommendations.
    GetLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
filters :: Prelude.Maybe [LambdaFunctionRecommendationFilter],
    -- | The token to advance to the next page of function recommendations.
    GetLambdaFunctionRecommendations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of function recommendations to return with a single
    -- request.
    --
    -- To retrieve the remaining results, make another request with the
    -- returned @nextToken@ value.
    GetLambdaFunctionRecommendations -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (GetLambdaFunctionRecommendations
-> GetLambdaFunctionRecommendations -> Bool
(GetLambdaFunctionRecommendations
 -> GetLambdaFunctionRecommendations -> Bool)
-> (GetLambdaFunctionRecommendations
    -> GetLambdaFunctionRecommendations -> Bool)
-> Eq GetLambdaFunctionRecommendations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLambdaFunctionRecommendations
-> GetLambdaFunctionRecommendations -> Bool
$c/= :: GetLambdaFunctionRecommendations
-> GetLambdaFunctionRecommendations -> Bool
== :: GetLambdaFunctionRecommendations
-> GetLambdaFunctionRecommendations -> Bool
$c== :: GetLambdaFunctionRecommendations
-> GetLambdaFunctionRecommendations -> Bool
Prelude.Eq, ReadPrec [GetLambdaFunctionRecommendations]
ReadPrec GetLambdaFunctionRecommendations
Int -> ReadS GetLambdaFunctionRecommendations
ReadS [GetLambdaFunctionRecommendations]
(Int -> ReadS GetLambdaFunctionRecommendations)
-> ReadS [GetLambdaFunctionRecommendations]
-> ReadPrec GetLambdaFunctionRecommendations
-> ReadPrec [GetLambdaFunctionRecommendations]
-> Read GetLambdaFunctionRecommendations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLambdaFunctionRecommendations]
$creadListPrec :: ReadPrec [GetLambdaFunctionRecommendations]
readPrec :: ReadPrec GetLambdaFunctionRecommendations
$creadPrec :: ReadPrec GetLambdaFunctionRecommendations
readList :: ReadS [GetLambdaFunctionRecommendations]
$creadList :: ReadS [GetLambdaFunctionRecommendations]
readsPrec :: Int -> ReadS GetLambdaFunctionRecommendations
$creadsPrec :: Int -> ReadS GetLambdaFunctionRecommendations
Prelude.Read, Int -> GetLambdaFunctionRecommendations -> ShowS
[GetLambdaFunctionRecommendations] -> ShowS
GetLambdaFunctionRecommendations -> String
(Int -> GetLambdaFunctionRecommendations -> ShowS)
-> (GetLambdaFunctionRecommendations -> String)
-> ([GetLambdaFunctionRecommendations] -> ShowS)
-> Show GetLambdaFunctionRecommendations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLambdaFunctionRecommendations] -> ShowS
$cshowList :: [GetLambdaFunctionRecommendations] -> ShowS
show :: GetLambdaFunctionRecommendations -> String
$cshow :: GetLambdaFunctionRecommendations -> String
showsPrec :: Int -> GetLambdaFunctionRecommendations -> ShowS
$cshowsPrec :: Int -> GetLambdaFunctionRecommendations -> ShowS
Prelude.Show, (forall x.
 GetLambdaFunctionRecommendations
 -> Rep GetLambdaFunctionRecommendations x)
-> (forall x.
    Rep GetLambdaFunctionRecommendations x
    -> GetLambdaFunctionRecommendations)
-> Generic GetLambdaFunctionRecommendations
forall x.
Rep GetLambdaFunctionRecommendations x
-> GetLambdaFunctionRecommendations
forall x.
GetLambdaFunctionRecommendations
-> Rep GetLambdaFunctionRecommendations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetLambdaFunctionRecommendations x
-> GetLambdaFunctionRecommendations
$cfrom :: forall x.
GetLambdaFunctionRecommendations
-> Rep GetLambdaFunctionRecommendations x
Prelude.Generic)

-- |
-- Create a value of 'GetLambdaFunctionRecommendations' 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:
--
-- 'functionArns', 'getLambdaFunctionRecommendations_functionArns' - The Amazon Resource Name (ARN) of the functions for which to return
-- recommendations.
--
-- You can specify a qualified or unqualified ARN. If you specify an
-- unqualified ARN without a function version suffix, Compute Optimizer
-- will return recommendations for the latest (@$LATEST@) version of the
-- function. If you specify a qualified ARN with a version suffix, Compute
-- Optimizer will return recommendations for the specified function
-- version. For more information about using function versions, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html#versioning-versions-using Using versions>
-- in the /Lambda Developer Guide/.
--
-- 'accountIds', 'getLambdaFunctionRecommendations_accountIds' - The ID of the Amazon Web Services account for which to return function
-- recommendations.
--
-- If your account is the management account of an organization, use this
-- parameter to specify the member account for which you want to return
-- function recommendations.
--
-- Only one account ID can be specified per request.
--
-- 'filters', 'getLambdaFunctionRecommendations_filters' - An array of objects to specify a filter that returns a more specific
-- list of function recommendations.
--
-- 'nextToken', 'getLambdaFunctionRecommendations_nextToken' - The token to advance to the next page of function recommendations.
--
-- 'maxResults', 'getLambdaFunctionRecommendations_maxResults' - The maximum number of function recommendations to return with a single
-- request.
--
-- To retrieve the remaining results, make another request with the
-- returned @nextToken@ value.
newGetLambdaFunctionRecommendations ::
  GetLambdaFunctionRecommendations
newGetLambdaFunctionRecommendations :: GetLambdaFunctionRecommendations
newGetLambdaFunctionRecommendations =
  GetLambdaFunctionRecommendations' :: Maybe [Text]
-> Maybe [Text]
-> Maybe [LambdaFunctionRecommendationFilter]
-> Maybe Text
-> Maybe Int
-> GetLambdaFunctionRecommendations
GetLambdaFunctionRecommendations'
    { $sel:functionArns:GetLambdaFunctionRecommendations' :: Maybe [Text]
functionArns =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:accountIds:GetLambdaFunctionRecommendations' :: Maybe [Text]
accountIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:GetLambdaFunctionRecommendations' :: Maybe [LambdaFunctionRecommendationFilter]
filters = Maybe [LambdaFunctionRecommendationFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetLambdaFunctionRecommendations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetLambdaFunctionRecommendations' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the functions for which to return
-- recommendations.
--
-- You can specify a qualified or unqualified ARN. If you specify an
-- unqualified ARN without a function version suffix, Compute Optimizer
-- will return recommendations for the latest (@$LATEST@) version of the
-- function. If you specify a qualified ARN with a version suffix, Compute
-- Optimizer will return recommendations for the specified function
-- version. For more information about using function versions, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html#versioning-versions-using Using versions>
-- in the /Lambda Developer Guide/.
getLambdaFunctionRecommendations_functionArns :: Lens.Lens' GetLambdaFunctionRecommendations (Prelude.Maybe [Prelude.Text])
getLambdaFunctionRecommendations_functionArns :: (Maybe [Text] -> f (Maybe [Text]))
-> GetLambdaFunctionRecommendations
-> f GetLambdaFunctionRecommendations
getLambdaFunctionRecommendations_functionArns = (GetLambdaFunctionRecommendations -> Maybe [Text])
-> (GetLambdaFunctionRecommendations
    -> Maybe [Text] -> GetLambdaFunctionRecommendations)
-> Lens
     GetLambdaFunctionRecommendations
     GetLambdaFunctionRecommendations
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLambdaFunctionRecommendations' {Maybe [Text]
functionArns :: Maybe [Text]
$sel:functionArns:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
functionArns} -> Maybe [Text]
functionArns) (\s :: GetLambdaFunctionRecommendations
s@GetLambdaFunctionRecommendations' {} Maybe [Text]
a -> GetLambdaFunctionRecommendations
s {$sel:functionArns:GetLambdaFunctionRecommendations' :: Maybe [Text]
functionArns = Maybe [Text]
a} :: GetLambdaFunctionRecommendations) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetLambdaFunctionRecommendations
 -> f GetLambdaFunctionRecommendations)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetLambdaFunctionRecommendations
-> f GetLambdaFunctionRecommendations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the Amazon Web Services account for which to return function
-- recommendations.
--
-- If your account is the management account of an organization, use this
-- parameter to specify the member account for which you want to return
-- function recommendations.
--
-- Only one account ID can be specified per request.
getLambdaFunctionRecommendations_accountIds :: Lens.Lens' GetLambdaFunctionRecommendations (Prelude.Maybe [Prelude.Text])
getLambdaFunctionRecommendations_accountIds :: (Maybe [Text] -> f (Maybe [Text]))
-> GetLambdaFunctionRecommendations
-> f GetLambdaFunctionRecommendations
getLambdaFunctionRecommendations_accountIds = (GetLambdaFunctionRecommendations -> Maybe [Text])
-> (GetLambdaFunctionRecommendations
    -> Maybe [Text] -> GetLambdaFunctionRecommendations)
-> Lens
     GetLambdaFunctionRecommendations
     GetLambdaFunctionRecommendations
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLambdaFunctionRecommendations' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
accountIds} -> Maybe [Text]
accountIds) (\s :: GetLambdaFunctionRecommendations
s@GetLambdaFunctionRecommendations' {} Maybe [Text]
a -> GetLambdaFunctionRecommendations
s {$sel:accountIds:GetLambdaFunctionRecommendations' :: Maybe [Text]
accountIds = Maybe [Text]
a} :: GetLambdaFunctionRecommendations) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetLambdaFunctionRecommendations
 -> f GetLambdaFunctionRecommendations)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetLambdaFunctionRecommendations
-> f GetLambdaFunctionRecommendations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An array of objects to specify a filter that returns a more specific
-- list of function recommendations.
getLambdaFunctionRecommendations_filters :: Lens.Lens' GetLambdaFunctionRecommendations (Prelude.Maybe [LambdaFunctionRecommendationFilter])
getLambdaFunctionRecommendations_filters :: (Maybe [LambdaFunctionRecommendationFilter]
 -> f (Maybe [LambdaFunctionRecommendationFilter]))
-> GetLambdaFunctionRecommendations
-> f GetLambdaFunctionRecommendations
getLambdaFunctionRecommendations_filters = (GetLambdaFunctionRecommendations
 -> Maybe [LambdaFunctionRecommendationFilter])
-> (GetLambdaFunctionRecommendations
    -> Maybe [LambdaFunctionRecommendationFilter]
    -> GetLambdaFunctionRecommendations)
-> Lens
     GetLambdaFunctionRecommendations
     GetLambdaFunctionRecommendations
     (Maybe [LambdaFunctionRecommendationFilter])
     (Maybe [LambdaFunctionRecommendationFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLambdaFunctionRecommendations' {Maybe [LambdaFunctionRecommendationFilter]
filters :: Maybe [LambdaFunctionRecommendationFilter]
$sel:filters:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
filters} -> Maybe [LambdaFunctionRecommendationFilter]
filters) (\s :: GetLambdaFunctionRecommendations
s@GetLambdaFunctionRecommendations' {} Maybe [LambdaFunctionRecommendationFilter]
a -> GetLambdaFunctionRecommendations
s {$sel:filters:GetLambdaFunctionRecommendations' :: Maybe [LambdaFunctionRecommendationFilter]
filters = Maybe [LambdaFunctionRecommendationFilter]
a} :: GetLambdaFunctionRecommendations) ((Maybe [LambdaFunctionRecommendationFilter]
  -> f (Maybe [LambdaFunctionRecommendationFilter]))
 -> GetLambdaFunctionRecommendations
 -> f GetLambdaFunctionRecommendations)
-> ((Maybe [LambdaFunctionRecommendationFilter]
     -> f (Maybe [LambdaFunctionRecommendationFilter]))
    -> Maybe [LambdaFunctionRecommendationFilter]
    -> f (Maybe [LambdaFunctionRecommendationFilter]))
-> (Maybe [LambdaFunctionRecommendationFilter]
    -> f (Maybe [LambdaFunctionRecommendationFilter]))
-> GetLambdaFunctionRecommendations
-> f GetLambdaFunctionRecommendations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LambdaFunctionRecommendationFilter]
  [LambdaFunctionRecommendationFilter]
  [LambdaFunctionRecommendationFilter]
  [LambdaFunctionRecommendationFilter]
-> Iso
     (Maybe [LambdaFunctionRecommendationFilter])
     (Maybe [LambdaFunctionRecommendationFilter])
     (Maybe [LambdaFunctionRecommendationFilter])
     (Maybe [LambdaFunctionRecommendationFilter])
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
  [LambdaFunctionRecommendationFilter]
  [LambdaFunctionRecommendationFilter]
  [LambdaFunctionRecommendationFilter]
  [LambdaFunctionRecommendationFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token to advance to the next page of function recommendations.
getLambdaFunctionRecommendations_nextToken :: Lens.Lens' GetLambdaFunctionRecommendations (Prelude.Maybe Prelude.Text)
getLambdaFunctionRecommendations_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetLambdaFunctionRecommendations
-> f GetLambdaFunctionRecommendations
getLambdaFunctionRecommendations_nextToken = (GetLambdaFunctionRecommendations -> Maybe Text)
-> (GetLambdaFunctionRecommendations
    -> Maybe Text -> GetLambdaFunctionRecommendations)
-> Lens
     GetLambdaFunctionRecommendations
     GetLambdaFunctionRecommendations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLambdaFunctionRecommendations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetLambdaFunctionRecommendations
s@GetLambdaFunctionRecommendations' {} Maybe Text
a -> GetLambdaFunctionRecommendations
s {$sel:nextToken:GetLambdaFunctionRecommendations' :: Maybe Text
nextToken = Maybe Text
a} :: GetLambdaFunctionRecommendations)

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

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

instance
  Prelude.NFData
    GetLambdaFunctionRecommendations

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

instance Core.ToJSON GetLambdaFunctionRecommendations where
  toJSON :: GetLambdaFunctionRecommendations -> Value
toJSON GetLambdaFunctionRecommendations' {Maybe Int
Maybe [Text]
Maybe [LambdaFunctionRecommendationFilter]
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
filters :: Maybe [LambdaFunctionRecommendationFilter]
accountIds :: Maybe [Text]
functionArns :: Maybe [Text]
$sel:maxResults:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Int
$sel:nextToken:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Text
$sel:filters:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
$sel:accountIds:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
$sel:functionArns:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"functionArns" 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]
functionArns,
            (Text
"accountIds" 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]
accountIds,
            (Text
"filters" Text -> [LambdaFunctionRecommendationFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([LambdaFunctionRecommendationFilter] -> Pair)
-> Maybe [LambdaFunctionRecommendationFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [LambdaFunctionRecommendationFilter]
filters,
            (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,
            (Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults
          ]
      )

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

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

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

-- |
-- Create a value of 'GetLambdaFunctionRecommendationsResponse' 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', 'getLambdaFunctionRecommendationsResponse_nextToken' - The token to use to advance to the next page of function
-- recommendations.
--
-- This value is null when there are no more pages of function
-- recommendations to return.
--
-- 'lambdaFunctionRecommendations', 'getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations' - An array of objects that describe function recommendations.
--
-- 'httpStatus', 'getLambdaFunctionRecommendationsResponse_httpStatus' - The response's http status code.
newGetLambdaFunctionRecommendationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetLambdaFunctionRecommendationsResponse
newGetLambdaFunctionRecommendationsResponse :: Int -> GetLambdaFunctionRecommendationsResponse
newGetLambdaFunctionRecommendationsResponse
  Int
pHttpStatus_ =
    GetLambdaFunctionRecommendationsResponse' :: Maybe Text
-> Maybe [LambdaFunctionRecommendation]
-> Int
-> GetLambdaFunctionRecommendationsResponse
GetLambdaFunctionRecommendationsResponse'
      { $sel:nextToken:GetLambdaFunctionRecommendationsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:lambdaFunctionRecommendations:GetLambdaFunctionRecommendationsResponse' :: Maybe [LambdaFunctionRecommendation]
lambdaFunctionRecommendations =
          Maybe [LambdaFunctionRecommendation]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetLambdaFunctionRecommendationsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

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

-- | An array of objects that describe function recommendations.
getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations :: Lens.Lens' GetLambdaFunctionRecommendationsResponse (Prelude.Maybe [LambdaFunctionRecommendation])
getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations :: (Maybe [LambdaFunctionRecommendation]
 -> f (Maybe [LambdaFunctionRecommendation]))
-> GetLambdaFunctionRecommendationsResponse
-> f GetLambdaFunctionRecommendationsResponse
getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations = (GetLambdaFunctionRecommendationsResponse
 -> Maybe [LambdaFunctionRecommendation])
-> (GetLambdaFunctionRecommendationsResponse
    -> Maybe [LambdaFunctionRecommendation]
    -> GetLambdaFunctionRecommendationsResponse)
-> Lens
     GetLambdaFunctionRecommendationsResponse
     GetLambdaFunctionRecommendationsResponse
     (Maybe [LambdaFunctionRecommendation])
     (Maybe [LambdaFunctionRecommendation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLambdaFunctionRecommendationsResponse' {Maybe [LambdaFunctionRecommendation]
lambdaFunctionRecommendations :: Maybe [LambdaFunctionRecommendation]
$sel:lambdaFunctionRecommendations:GetLambdaFunctionRecommendationsResponse' :: GetLambdaFunctionRecommendationsResponse
-> Maybe [LambdaFunctionRecommendation]
lambdaFunctionRecommendations} -> Maybe [LambdaFunctionRecommendation]
lambdaFunctionRecommendations) (\s :: GetLambdaFunctionRecommendationsResponse
s@GetLambdaFunctionRecommendationsResponse' {} Maybe [LambdaFunctionRecommendation]
a -> GetLambdaFunctionRecommendationsResponse
s {$sel:lambdaFunctionRecommendations:GetLambdaFunctionRecommendationsResponse' :: Maybe [LambdaFunctionRecommendation]
lambdaFunctionRecommendations = Maybe [LambdaFunctionRecommendation]
a} :: GetLambdaFunctionRecommendationsResponse) ((Maybe [LambdaFunctionRecommendation]
  -> f (Maybe [LambdaFunctionRecommendation]))
 -> GetLambdaFunctionRecommendationsResponse
 -> f GetLambdaFunctionRecommendationsResponse)
-> ((Maybe [LambdaFunctionRecommendation]
     -> f (Maybe [LambdaFunctionRecommendation]))
    -> Maybe [LambdaFunctionRecommendation]
    -> f (Maybe [LambdaFunctionRecommendation]))
-> (Maybe [LambdaFunctionRecommendation]
    -> f (Maybe [LambdaFunctionRecommendation]))
-> GetLambdaFunctionRecommendationsResponse
-> f GetLambdaFunctionRecommendationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LambdaFunctionRecommendation]
  [LambdaFunctionRecommendation]
  [LambdaFunctionRecommendation]
  [LambdaFunctionRecommendation]
-> Iso
     (Maybe [LambdaFunctionRecommendation])
     (Maybe [LambdaFunctionRecommendation])
     (Maybe [LambdaFunctionRecommendation])
     (Maybe [LambdaFunctionRecommendation])
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
  [LambdaFunctionRecommendation]
  [LambdaFunctionRecommendation]
  [LambdaFunctionRecommendation]
  [LambdaFunctionRecommendation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetLambdaFunctionRecommendationsResponse