{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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/.
--
-- This operation returns paginated results.
module Amazonka.ComputeOptimizer.GetLambdaFunctionRecommendations
  ( -- * Creating a Request
    GetLambdaFunctionRecommendations (..),
    newGetLambdaFunctionRecommendations,

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

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

    -- * Response Lenses
    getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations,
    getLambdaFunctionRecommendationsResponse_nextToken,
    getLambdaFunctionRecommendationsResponse_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:/ 'newGetLambdaFunctionRecommendations' smart constructor.
data GetLambdaFunctionRecommendations = GetLambdaFunctionRecommendations'
  { -- | 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 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 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 Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token to advance to the next page of function recommendations.
    GetLambdaFunctionRecommendations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (GetLambdaFunctionRecommendations
-> GetLambdaFunctionRecommendations -> Bool
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]
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
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.
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:
--
-- '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.
--
-- '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/.
--
-- '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.
--
-- 'nextToken', 'getLambdaFunctionRecommendations_nextToken' - The token to advance to the next page of function recommendations.
newGetLambdaFunctionRecommendations ::
  GetLambdaFunctionRecommendations
newGetLambdaFunctionRecommendations :: GetLambdaFunctionRecommendations
newGetLambdaFunctionRecommendations =
  GetLambdaFunctionRecommendations'
    { $sel:accountIds:GetLambdaFunctionRecommendations' :: Maybe [Text]
accountIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:filters:GetLambdaFunctionRecommendations' :: Maybe [LambdaFunctionRecommendationFilter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:functionArns:GetLambdaFunctionRecommendations' :: Maybe [Text]
functionArns = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetLambdaFunctionRecommendations' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetLambdaFunctionRecommendations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' GetLambdaFunctionRecommendations (Maybe [Text])
getLambdaFunctionRecommendations_accountIds = 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) 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

-- | 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 :: Lens'
  GetLambdaFunctionRecommendations
  (Maybe [LambdaFunctionRecommendationFilter])
getLambdaFunctionRecommendations_filters = 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) 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 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 :: Lens' GetLambdaFunctionRecommendations (Maybe [Text])
getLambdaFunctionRecommendations_functionArns = 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) 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 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.Natural)
getLambdaFunctionRecommendations_maxResults :: Lens' GetLambdaFunctionRecommendations (Maybe Natural)
getLambdaFunctionRecommendations_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLambdaFunctionRecommendations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetLambdaFunctionRecommendations
s@GetLambdaFunctionRecommendations' {} Maybe Natural
a -> GetLambdaFunctionRecommendations
s {$sel:maxResults:GetLambdaFunctionRecommendations' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetLambdaFunctionRecommendations)

-- | The token to advance to the next page of function recommendations.
getLambdaFunctionRecommendations_nextToken :: Lens.Lens' GetLambdaFunctionRecommendations (Prelude.Maybe Prelude.Text)
getLambdaFunctionRecommendations_nextToken :: Lens' GetLambdaFunctionRecommendations (Maybe Text)
getLambdaFunctionRecommendations_nextToken = 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)

instance
  Core.AWSPager
    GetLambdaFunctionRecommendations
  where
  page :: GetLambdaFunctionRecommendations
-> AWSResponse GetLambdaFunctionRecommendations
-> Maybe GetLambdaFunctionRecommendations
page GetLambdaFunctionRecommendations
rq AWSResponse GetLambdaFunctionRecommendations
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetLambdaFunctionRecommendations
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetLambdaFunctionRecommendationsResponse (Maybe Text)
getLambdaFunctionRecommendationsResponse_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 GetLambdaFunctionRecommendations
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  GetLambdaFunctionRecommendationsResponse
  (Maybe [LambdaFunctionRecommendation])
getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations
            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.$ GetLambdaFunctionRecommendations
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetLambdaFunctionRecommendations (Maybe Text)
getLambdaFunctionRecommendations_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetLambdaFunctionRecommendations
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetLambdaFunctionRecommendationsResponse (Maybe Text)
getLambdaFunctionRecommendationsResponse_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
    GetLambdaFunctionRecommendations
  where
  type
    AWSResponse GetLambdaFunctionRecommendations =
      GetLambdaFunctionRecommendationsResponse
  request :: (Service -> Service)
-> GetLambdaFunctionRecommendations
-> Request GetLambdaFunctionRecommendations
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 GetLambdaFunctionRecommendations
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetLambdaFunctionRecommendations)))
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 [LambdaFunctionRecommendation]
-> Maybe Text -> Int -> GetLambdaFunctionRecommendationsResponse
GetLambdaFunctionRecommendationsResponse'
            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
"lambdaFunctionRecommendations"
                            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.<*> (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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    GetLambdaFunctionRecommendations
  where
  hashWithSalt :: Int -> GetLambdaFunctionRecommendations -> Int
hashWithSalt
    Int
_salt
    GetLambdaFunctionRecommendations' {Maybe Natural
Maybe [Text]
Maybe [LambdaFunctionRecommendationFilter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
functionArns :: Maybe [Text]
filters :: Maybe [LambdaFunctionRecommendationFilter]
accountIds :: Maybe [Text]
$sel:nextToken:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Text
$sel:maxResults:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Natural
$sel:functionArns:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
$sel:filters:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
$sel:accountIds:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
accountIds
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LambdaFunctionRecommendationFilter]
filters
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
functionArns
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance
  Prelude.NFData
    GetLambdaFunctionRecommendations
  where
  rnf :: GetLambdaFunctionRecommendations -> ()
rnf GetLambdaFunctionRecommendations' {Maybe Natural
Maybe [Text]
Maybe [LambdaFunctionRecommendationFilter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
functionArns :: Maybe [Text]
filters :: Maybe [LambdaFunctionRecommendationFilter]
accountIds :: Maybe [Text]
$sel:nextToken:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Text
$sel:maxResults:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Natural
$sel:functionArns:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
$sel:filters:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
$sel:accountIds:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
accountIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [LambdaFunctionRecommendationFilter]
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
functionArns
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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

instance
  Data.ToHeaders
    GetLambdaFunctionRecommendations
  where
  toHeaders :: GetLambdaFunctionRecommendations -> 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.GetLambdaFunctionRecommendations" ::
                          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 GetLambdaFunctionRecommendations where
  toJSON :: GetLambdaFunctionRecommendations -> Value
toJSON GetLambdaFunctionRecommendations' {Maybe Natural
Maybe [Text]
Maybe [LambdaFunctionRecommendationFilter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
functionArns :: Maybe [Text]
filters :: Maybe [LambdaFunctionRecommendationFilter]
accountIds :: Maybe [Text]
$sel:nextToken:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Text
$sel:maxResults:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe Natural
$sel:functionArns:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
$sel:filters:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
$sel:accountIds:GetLambdaFunctionRecommendations' :: GetLambdaFunctionRecommendations -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"accountIds" 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]
accountIds,
            (Key
"filters" 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 [LambdaFunctionRecommendationFilter]
filters,
            (Key
"functionArns" 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]
functionArns,
            (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
          ]
      )

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

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

-- | /See:/ 'newGetLambdaFunctionRecommendationsResponse' smart constructor.
data GetLambdaFunctionRecommendationsResponse = GetLambdaFunctionRecommendationsResponse'
  { -- | An array of objects that describe function recommendations.
    GetLambdaFunctionRecommendationsResponse
-> Maybe [LambdaFunctionRecommendation]
lambdaFunctionRecommendations :: Prelude.Maybe [LambdaFunctionRecommendation],
    -- | 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,
    -- | The response's http status code.
    GetLambdaFunctionRecommendationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetLambdaFunctionRecommendationsResponse
-> GetLambdaFunctionRecommendationsResponse -> Bool
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]
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
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.
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:
--
-- 'lambdaFunctionRecommendations', 'getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations' - An array of objects that describe function recommendations.
--
-- '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.
--
-- 'httpStatus', 'getLambdaFunctionRecommendationsResponse_httpStatus' - The response's http status code.
newGetLambdaFunctionRecommendationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetLambdaFunctionRecommendationsResponse
newGetLambdaFunctionRecommendationsResponse :: Int -> GetLambdaFunctionRecommendationsResponse
newGetLambdaFunctionRecommendationsResponse
  Int
pHttpStatus_ =
    GetLambdaFunctionRecommendationsResponse'
      { $sel:lambdaFunctionRecommendations:GetLambdaFunctionRecommendationsResponse' :: Maybe [LambdaFunctionRecommendation]
lambdaFunctionRecommendations =
          forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetLambdaFunctionRecommendationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetLambdaFunctionRecommendationsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | An array of objects that describe function recommendations.
getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations :: Lens.Lens' GetLambdaFunctionRecommendationsResponse (Prelude.Maybe [LambdaFunctionRecommendation])
getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations :: Lens'
  GetLambdaFunctionRecommendationsResponse
  (Maybe [LambdaFunctionRecommendation])
getLambdaFunctionRecommendationsResponse_lambdaFunctionRecommendations = 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) 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 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 :: Lens' GetLambdaFunctionRecommendationsResponse (Maybe Text)
getLambdaFunctionRecommendationsResponse_nextToken = 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)

-- | The response's http status code.
getLambdaFunctionRecommendationsResponse_httpStatus :: Lens.Lens' GetLambdaFunctionRecommendationsResponse Prelude.Int
getLambdaFunctionRecommendationsResponse_httpStatus :: Lens' GetLambdaFunctionRecommendationsResponse Int
getLambdaFunctionRecommendationsResponse_httpStatus = 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
  where
  rnf :: GetLambdaFunctionRecommendationsResponse -> ()
rnf GetLambdaFunctionRecommendationsResponse' {Int
Maybe [LambdaFunctionRecommendation]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
lambdaFunctionRecommendations :: Maybe [LambdaFunctionRecommendation]
$sel:httpStatus:GetLambdaFunctionRecommendationsResponse' :: GetLambdaFunctionRecommendationsResponse -> Int
$sel:nextToken:GetLambdaFunctionRecommendationsResponse' :: GetLambdaFunctionRecommendationsResponse -> Maybe Text
$sel:lambdaFunctionRecommendations:GetLambdaFunctionRecommendationsResponse' :: GetLambdaFunctionRecommendationsResponse
-> Maybe [LambdaFunctionRecommendation]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [LambdaFunctionRecommendation]
lambdaFunctionRecommendations
      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 Int
httpStatus