{-# 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.ExportLambdaFunctionRecommendations
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Exports optimization recommendations for Lambda functions.
--
-- Recommendations are exported in a comma-separated values (.csv) file,
-- and its metadata in a JavaScript Object Notation (JSON) (.json) file, to
-- an existing Amazon Simple Storage Service (Amazon S3) bucket that you
-- specify. For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html Exporting Recommendations>
-- in the /Compute Optimizer User Guide/.
--
-- You can have only one Lambda function export job in progress per Amazon
-- Web Services Region.
module Amazonka.ComputeOptimizer.ExportLambdaFunctionRecommendations
  ( -- * Creating a Request
    ExportLambdaFunctionRecommendations (..),
    newExportLambdaFunctionRecommendations,

    -- * Request Lenses
    exportLambdaFunctionRecommendations_accountIds,
    exportLambdaFunctionRecommendations_fieldsToExport,
    exportLambdaFunctionRecommendations_fileFormat,
    exportLambdaFunctionRecommendations_filters,
    exportLambdaFunctionRecommendations_includeMemberAccounts,
    exportLambdaFunctionRecommendations_s3DestinationConfig,

    -- * Destructuring the Response
    ExportLambdaFunctionRecommendationsResponse (..),
    newExportLambdaFunctionRecommendationsResponse,

    -- * Response Lenses
    exportLambdaFunctionRecommendationsResponse_jobId,
    exportLambdaFunctionRecommendationsResponse_s3Destination,
    exportLambdaFunctionRecommendationsResponse_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:/ 'newExportLambdaFunctionRecommendations' smart constructor.
data ExportLambdaFunctionRecommendations = ExportLambdaFunctionRecommendations'
  { -- | The IDs of the Amazon Web Services accounts for which to export Lambda
    -- 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 export
    -- recommendations.
    --
    -- This parameter cannot be specified together with the include member
    -- accounts parameter. The parameters are mutually exclusive.
    --
    -- Recommendations for member accounts are not included in the export if
    -- this parameter, or the include member accounts parameter, is omitted.
    --
    -- You can specify multiple account IDs per request.
    ExportLambdaFunctionRecommendations -> Maybe [Text]
accountIds :: Prelude.Maybe [Prelude.Text],
    -- | The recommendations data to include in the export file. For more
    -- information about the fields that can be exported, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html#exported-files Exported files>
    -- in the /Compute Optimizer User Guide/.
    ExportLambdaFunctionRecommendations
-> Maybe [ExportableLambdaFunctionField]
fieldsToExport :: Prelude.Maybe [ExportableLambdaFunctionField],
    -- | The format of the export file.
    --
    -- The only export file format currently supported is @Csv@.
    ExportLambdaFunctionRecommendations -> Maybe FileFormat
fileFormat :: Prelude.Maybe FileFormat,
    -- | An array of objects to specify a filter that exports a more specific set
    -- of Lambda function recommendations.
    ExportLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
filters :: Prelude.Maybe [LambdaFunctionRecommendationFilter],
    -- | Indicates whether to include recommendations for resources in all member
    -- accounts of the organization if your account is the management account
    -- of an organization.
    --
    -- The member accounts must also be opted in to Compute Optimizer, and
    -- trusted access for Compute Optimizer must be enabled in the organization
    -- account. For more information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/security-iam.html#trusted-service-access Compute Optimizer and Amazon Web Services Organizations trusted access>
    -- in the /Compute Optimizer User Guide/.
    --
    -- Recommendations for member accounts of the organization are not included
    -- in the export file if this parameter is omitted.
    --
    -- This parameter cannot be specified together with the account IDs
    -- parameter. The parameters are mutually exclusive.
    --
    -- Recommendations for member accounts are not included in the export if
    -- this parameter, or the account IDs parameter, is omitted.
    ExportLambdaFunctionRecommendations -> Maybe Bool
includeMemberAccounts :: Prelude.Maybe Prelude.Bool,
    ExportLambdaFunctionRecommendations -> S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
  }
  deriving (ExportLambdaFunctionRecommendations
-> ExportLambdaFunctionRecommendations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportLambdaFunctionRecommendations
-> ExportLambdaFunctionRecommendations -> Bool
$c/= :: ExportLambdaFunctionRecommendations
-> ExportLambdaFunctionRecommendations -> Bool
== :: ExportLambdaFunctionRecommendations
-> ExportLambdaFunctionRecommendations -> Bool
$c== :: ExportLambdaFunctionRecommendations
-> ExportLambdaFunctionRecommendations -> Bool
Prelude.Eq, ReadPrec [ExportLambdaFunctionRecommendations]
ReadPrec ExportLambdaFunctionRecommendations
Int -> ReadS ExportLambdaFunctionRecommendations
ReadS [ExportLambdaFunctionRecommendations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportLambdaFunctionRecommendations]
$creadListPrec :: ReadPrec [ExportLambdaFunctionRecommendations]
readPrec :: ReadPrec ExportLambdaFunctionRecommendations
$creadPrec :: ReadPrec ExportLambdaFunctionRecommendations
readList :: ReadS [ExportLambdaFunctionRecommendations]
$creadList :: ReadS [ExportLambdaFunctionRecommendations]
readsPrec :: Int -> ReadS ExportLambdaFunctionRecommendations
$creadsPrec :: Int -> ReadS ExportLambdaFunctionRecommendations
Prelude.Read, Int -> ExportLambdaFunctionRecommendations -> ShowS
[ExportLambdaFunctionRecommendations] -> ShowS
ExportLambdaFunctionRecommendations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportLambdaFunctionRecommendations] -> ShowS
$cshowList :: [ExportLambdaFunctionRecommendations] -> ShowS
show :: ExportLambdaFunctionRecommendations -> String
$cshow :: ExportLambdaFunctionRecommendations -> String
showsPrec :: Int -> ExportLambdaFunctionRecommendations -> ShowS
$cshowsPrec :: Int -> ExportLambdaFunctionRecommendations -> ShowS
Prelude.Show, forall x.
Rep ExportLambdaFunctionRecommendations x
-> ExportLambdaFunctionRecommendations
forall x.
ExportLambdaFunctionRecommendations
-> Rep ExportLambdaFunctionRecommendations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExportLambdaFunctionRecommendations x
-> ExportLambdaFunctionRecommendations
$cfrom :: forall x.
ExportLambdaFunctionRecommendations
-> Rep ExportLambdaFunctionRecommendations x
Prelude.Generic)

-- |
-- Create a value of 'ExportLambdaFunctionRecommendations' 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', 'exportLambdaFunctionRecommendations_accountIds' - The IDs of the Amazon Web Services accounts for which to export Lambda
-- 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 export
-- recommendations.
--
-- This parameter cannot be specified together with the include member
-- accounts parameter. The parameters are mutually exclusive.
--
-- Recommendations for member accounts are not included in the export if
-- this parameter, or the include member accounts parameter, is omitted.
--
-- You can specify multiple account IDs per request.
--
-- 'fieldsToExport', 'exportLambdaFunctionRecommendations_fieldsToExport' - The recommendations data to include in the export file. For more
-- information about the fields that can be exported, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html#exported-files Exported files>
-- in the /Compute Optimizer User Guide/.
--
-- 'fileFormat', 'exportLambdaFunctionRecommendations_fileFormat' - The format of the export file.
--
-- The only export file format currently supported is @Csv@.
--
-- 'filters', 'exportLambdaFunctionRecommendations_filters' - An array of objects to specify a filter that exports a more specific set
-- of Lambda function recommendations.
--
-- 'includeMemberAccounts', 'exportLambdaFunctionRecommendations_includeMemberAccounts' - Indicates whether to include recommendations for resources in all member
-- accounts of the organization if your account is the management account
-- of an organization.
--
-- The member accounts must also be opted in to Compute Optimizer, and
-- trusted access for Compute Optimizer must be enabled in the organization
-- account. For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/security-iam.html#trusted-service-access Compute Optimizer and Amazon Web Services Organizations trusted access>
-- in the /Compute Optimizer User Guide/.
--
-- Recommendations for member accounts of the organization are not included
-- in the export file if this parameter is omitted.
--
-- This parameter cannot be specified together with the account IDs
-- parameter. The parameters are mutually exclusive.
--
-- Recommendations for member accounts are not included in the export if
-- this parameter, or the account IDs parameter, is omitted.
--
-- 's3DestinationConfig', 'exportLambdaFunctionRecommendations_s3DestinationConfig' - Undocumented member.
newExportLambdaFunctionRecommendations ::
  -- | 's3DestinationConfig'
  S3DestinationConfig ->
  ExportLambdaFunctionRecommendations
newExportLambdaFunctionRecommendations :: S3DestinationConfig -> ExportLambdaFunctionRecommendations
newExportLambdaFunctionRecommendations
  S3DestinationConfig
pS3DestinationConfig_ =
    ExportLambdaFunctionRecommendations'
      { $sel:accountIds:ExportLambdaFunctionRecommendations' :: Maybe [Text]
accountIds =
          forall a. Maybe a
Prelude.Nothing,
        $sel:fieldsToExport:ExportLambdaFunctionRecommendations' :: Maybe [ExportableLambdaFunctionField]
fieldsToExport = forall a. Maybe a
Prelude.Nothing,
        $sel:fileFormat:ExportLambdaFunctionRecommendations' :: Maybe FileFormat
fileFormat = forall a. Maybe a
Prelude.Nothing,
        $sel:filters:ExportLambdaFunctionRecommendations' :: Maybe [LambdaFunctionRecommendationFilter]
filters = forall a. Maybe a
Prelude.Nothing,
        $sel:includeMemberAccounts:ExportLambdaFunctionRecommendations' :: Maybe Bool
includeMemberAccounts =
          forall a. Maybe a
Prelude.Nothing,
        $sel:s3DestinationConfig:ExportLambdaFunctionRecommendations' :: S3DestinationConfig
s3DestinationConfig =
          S3DestinationConfig
pS3DestinationConfig_
      }

-- | The IDs of the Amazon Web Services accounts for which to export Lambda
-- 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 export
-- recommendations.
--
-- This parameter cannot be specified together with the include member
-- accounts parameter. The parameters are mutually exclusive.
--
-- Recommendations for member accounts are not included in the export if
-- this parameter, or the include member accounts parameter, is omitted.
--
-- You can specify multiple account IDs per request.
exportLambdaFunctionRecommendations_accountIds :: Lens.Lens' ExportLambdaFunctionRecommendations (Prelude.Maybe [Prelude.Text])
exportLambdaFunctionRecommendations_accountIds :: Lens' ExportLambdaFunctionRecommendations (Maybe [Text])
exportLambdaFunctionRecommendations_accountIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportLambdaFunctionRecommendations' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> Maybe [Text]
accountIds} -> Maybe [Text]
accountIds) (\s :: ExportLambdaFunctionRecommendations
s@ExportLambdaFunctionRecommendations' {} Maybe [Text]
a -> ExportLambdaFunctionRecommendations
s {$sel:accountIds:ExportLambdaFunctionRecommendations' :: Maybe [Text]
accountIds = Maybe [Text]
a} :: ExportLambdaFunctionRecommendations) 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 recommendations data to include in the export file. For more
-- information about the fields that can be exported, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html#exported-files Exported files>
-- in the /Compute Optimizer User Guide/.
exportLambdaFunctionRecommendations_fieldsToExport :: Lens.Lens' ExportLambdaFunctionRecommendations (Prelude.Maybe [ExportableLambdaFunctionField])
exportLambdaFunctionRecommendations_fieldsToExport :: Lens'
  ExportLambdaFunctionRecommendations
  (Maybe [ExportableLambdaFunctionField])
exportLambdaFunctionRecommendations_fieldsToExport = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportLambdaFunctionRecommendations' {Maybe [ExportableLambdaFunctionField]
fieldsToExport :: Maybe [ExportableLambdaFunctionField]
$sel:fieldsToExport:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations
-> Maybe [ExportableLambdaFunctionField]
fieldsToExport} -> Maybe [ExportableLambdaFunctionField]
fieldsToExport) (\s :: ExportLambdaFunctionRecommendations
s@ExportLambdaFunctionRecommendations' {} Maybe [ExportableLambdaFunctionField]
a -> ExportLambdaFunctionRecommendations
s {$sel:fieldsToExport:ExportLambdaFunctionRecommendations' :: Maybe [ExportableLambdaFunctionField]
fieldsToExport = Maybe [ExportableLambdaFunctionField]
a} :: ExportLambdaFunctionRecommendations) 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 format of the export file.
--
-- The only export file format currently supported is @Csv@.
exportLambdaFunctionRecommendations_fileFormat :: Lens.Lens' ExportLambdaFunctionRecommendations (Prelude.Maybe FileFormat)
exportLambdaFunctionRecommendations_fileFormat :: Lens' ExportLambdaFunctionRecommendations (Maybe FileFormat)
exportLambdaFunctionRecommendations_fileFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportLambdaFunctionRecommendations' {Maybe FileFormat
fileFormat :: Maybe FileFormat
$sel:fileFormat:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> Maybe FileFormat
fileFormat} -> Maybe FileFormat
fileFormat) (\s :: ExportLambdaFunctionRecommendations
s@ExportLambdaFunctionRecommendations' {} Maybe FileFormat
a -> ExportLambdaFunctionRecommendations
s {$sel:fileFormat:ExportLambdaFunctionRecommendations' :: Maybe FileFormat
fileFormat = Maybe FileFormat
a} :: ExportLambdaFunctionRecommendations)

-- | An array of objects to specify a filter that exports a more specific set
-- of Lambda function recommendations.
exportLambdaFunctionRecommendations_filters :: Lens.Lens' ExportLambdaFunctionRecommendations (Prelude.Maybe [LambdaFunctionRecommendationFilter])
exportLambdaFunctionRecommendations_filters :: Lens'
  ExportLambdaFunctionRecommendations
  (Maybe [LambdaFunctionRecommendationFilter])
exportLambdaFunctionRecommendations_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportLambdaFunctionRecommendations' {Maybe [LambdaFunctionRecommendationFilter]
filters :: Maybe [LambdaFunctionRecommendationFilter]
$sel:filters:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
filters} -> Maybe [LambdaFunctionRecommendationFilter]
filters) (\s :: ExportLambdaFunctionRecommendations
s@ExportLambdaFunctionRecommendations' {} Maybe [LambdaFunctionRecommendationFilter]
a -> ExportLambdaFunctionRecommendations
s {$sel:filters:ExportLambdaFunctionRecommendations' :: Maybe [LambdaFunctionRecommendationFilter]
filters = Maybe [LambdaFunctionRecommendationFilter]
a} :: ExportLambdaFunctionRecommendations) 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

-- | Indicates whether to include recommendations for resources in all member
-- accounts of the organization if your account is the management account
-- of an organization.
--
-- The member accounts must also be opted in to Compute Optimizer, and
-- trusted access for Compute Optimizer must be enabled in the organization
-- account. For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/security-iam.html#trusted-service-access Compute Optimizer and Amazon Web Services Organizations trusted access>
-- in the /Compute Optimizer User Guide/.
--
-- Recommendations for member accounts of the organization are not included
-- in the export file if this parameter is omitted.
--
-- This parameter cannot be specified together with the account IDs
-- parameter. The parameters are mutually exclusive.
--
-- Recommendations for member accounts are not included in the export if
-- this parameter, or the account IDs parameter, is omitted.
exportLambdaFunctionRecommendations_includeMemberAccounts :: Lens.Lens' ExportLambdaFunctionRecommendations (Prelude.Maybe Prelude.Bool)
exportLambdaFunctionRecommendations_includeMemberAccounts :: Lens' ExportLambdaFunctionRecommendations (Maybe Bool)
exportLambdaFunctionRecommendations_includeMemberAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportLambdaFunctionRecommendations' {Maybe Bool
includeMemberAccounts :: Maybe Bool
$sel:includeMemberAccounts:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> Maybe Bool
includeMemberAccounts} -> Maybe Bool
includeMemberAccounts) (\s :: ExportLambdaFunctionRecommendations
s@ExportLambdaFunctionRecommendations' {} Maybe Bool
a -> ExportLambdaFunctionRecommendations
s {$sel:includeMemberAccounts:ExportLambdaFunctionRecommendations' :: Maybe Bool
includeMemberAccounts = Maybe Bool
a} :: ExportLambdaFunctionRecommendations)

-- | Undocumented member.
exportLambdaFunctionRecommendations_s3DestinationConfig :: Lens.Lens' ExportLambdaFunctionRecommendations S3DestinationConfig
exportLambdaFunctionRecommendations_s3DestinationConfig :: Lens' ExportLambdaFunctionRecommendations S3DestinationConfig
exportLambdaFunctionRecommendations_s3DestinationConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportLambdaFunctionRecommendations' {S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
$sel:s3DestinationConfig:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> S3DestinationConfig
s3DestinationConfig} -> S3DestinationConfig
s3DestinationConfig) (\s :: ExportLambdaFunctionRecommendations
s@ExportLambdaFunctionRecommendations' {} S3DestinationConfig
a -> ExportLambdaFunctionRecommendations
s {$sel:s3DestinationConfig:ExportLambdaFunctionRecommendations' :: S3DestinationConfig
s3DestinationConfig = S3DestinationConfig
a} :: ExportLambdaFunctionRecommendations)

instance
  Core.AWSRequest
    ExportLambdaFunctionRecommendations
  where
  type
    AWSResponse ExportLambdaFunctionRecommendations =
      ExportLambdaFunctionRecommendationsResponse
  request :: (Service -> Service)
-> ExportLambdaFunctionRecommendations
-> Request ExportLambdaFunctionRecommendations
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 ExportLambdaFunctionRecommendations
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ExportLambdaFunctionRecommendations)))
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 S3Destination
-> Int
-> ExportLambdaFunctionRecommendationsResponse
ExportLambdaFunctionRecommendationsResponse'
            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
"jobId")
            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
"s3Destination")
            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
    ExportLambdaFunctionRecommendations
  where
  hashWithSalt :: Int -> ExportLambdaFunctionRecommendations -> Int
hashWithSalt
    Int
_salt
    ExportLambdaFunctionRecommendations' {Maybe Bool
Maybe [Text]
Maybe [ExportableLambdaFunctionField]
Maybe [LambdaFunctionRecommendationFilter]
Maybe FileFormat
S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
includeMemberAccounts :: Maybe Bool
filters :: Maybe [LambdaFunctionRecommendationFilter]
fileFormat :: Maybe FileFormat
fieldsToExport :: Maybe [ExportableLambdaFunctionField]
accountIds :: Maybe [Text]
$sel:s3DestinationConfig:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> S3DestinationConfig
$sel:includeMemberAccounts:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> Maybe Bool
$sel:filters:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
$sel:fileFormat:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> Maybe FileFormat
$sel:fieldsToExport:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations
-> Maybe [ExportableLambdaFunctionField]
$sel:accountIds:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> 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 [ExportableLambdaFunctionField]
fieldsToExport
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FileFormat
fileFormat
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LambdaFunctionRecommendationFilter]
filters
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
includeMemberAccounts
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3DestinationConfig
s3DestinationConfig

instance
  Prelude.NFData
    ExportLambdaFunctionRecommendations
  where
  rnf :: ExportLambdaFunctionRecommendations -> ()
rnf ExportLambdaFunctionRecommendations' {Maybe Bool
Maybe [Text]
Maybe [ExportableLambdaFunctionField]
Maybe [LambdaFunctionRecommendationFilter]
Maybe FileFormat
S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
includeMemberAccounts :: Maybe Bool
filters :: Maybe [LambdaFunctionRecommendationFilter]
fileFormat :: Maybe FileFormat
fieldsToExport :: Maybe [ExportableLambdaFunctionField]
accountIds :: Maybe [Text]
$sel:s3DestinationConfig:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> S3DestinationConfig
$sel:includeMemberAccounts:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> Maybe Bool
$sel:filters:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
$sel:fileFormat:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> Maybe FileFormat
$sel:fieldsToExport:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations
-> Maybe [ExportableLambdaFunctionField]
$sel:accountIds:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> 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 [ExportableLambdaFunctionField]
fieldsToExport
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FileFormat
fileFormat
      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 Bool
includeMemberAccounts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf S3DestinationConfig
s3DestinationConfig

instance
  Data.ToHeaders
    ExportLambdaFunctionRecommendations
  where
  toHeaders :: ExportLambdaFunctionRecommendations -> 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.ExportLambdaFunctionRecommendations" ::
                          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
    ExportLambdaFunctionRecommendations
  where
  toJSON :: ExportLambdaFunctionRecommendations -> Value
toJSON ExportLambdaFunctionRecommendations' {Maybe Bool
Maybe [Text]
Maybe [ExportableLambdaFunctionField]
Maybe [LambdaFunctionRecommendationFilter]
Maybe FileFormat
S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
includeMemberAccounts :: Maybe Bool
filters :: Maybe [LambdaFunctionRecommendationFilter]
fileFormat :: Maybe FileFormat
fieldsToExport :: Maybe [ExportableLambdaFunctionField]
accountIds :: Maybe [Text]
$sel:s3DestinationConfig:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> S3DestinationConfig
$sel:includeMemberAccounts:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> Maybe Bool
$sel:filters:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations
-> Maybe [LambdaFunctionRecommendationFilter]
$sel:fileFormat:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> Maybe FileFormat
$sel:fieldsToExport:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations
-> Maybe [ExportableLambdaFunctionField]
$sel:accountIds:ExportLambdaFunctionRecommendations' :: ExportLambdaFunctionRecommendations -> 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
"fieldsToExport" 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 [ExportableLambdaFunctionField]
fieldsToExport,
            (Key
"fileFormat" 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 FileFormat
fileFormat,
            (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
"includeMemberAccounts" 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 Bool
includeMemberAccounts,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"s3DestinationConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3DestinationConfig
s3DestinationConfig)
          ]
      )

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

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

-- | /See:/ 'newExportLambdaFunctionRecommendationsResponse' smart constructor.
data ExportLambdaFunctionRecommendationsResponse = ExportLambdaFunctionRecommendationsResponse'
  { -- | The identification number of the export job.
    --
    -- Use the DescribeRecommendationExportJobs action, and specify the job ID
    -- to view the status of an export job.
    ExportLambdaFunctionRecommendationsResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    ExportLambdaFunctionRecommendationsResponse -> Maybe S3Destination
s3Destination :: Prelude.Maybe S3Destination,
    -- | The response's http status code.
    ExportLambdaFunctionRecommendationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ExportLambdaFunctionRecommendationsResponse
-> ExportLambdaFunctionRecommendationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportLambdaFunctionRecommendationsResponse
-> ExportLambdaFunctionRecommendationsResponse -> Bool
$c/= :: ExportLambdaFunctionRecommendationsResponse
-> ExportLambdaFunctionRecommendationsResponse -> Bool
== :: ExportLambdaFunctionRecommendationsResponse
-> ExportLambdaFunctionRecommendationsResponse -> Bool
$c== :: ExportLambdaFunctionRecommendationsResponse
-> ExportLambdaFunctionRecommendationsResponse -> Bool
Prelude.Eq, ReadPrec [ExportLambdaFunctionRecommendationsResponse]
ReadPrec ExportLambdaFunctionRecommendationsResponse
Int -> ReadS ExportLambdaFunctionRecommendationsResponse
ReadS [ExportLambdaFunctionRecommendationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportLambdaFunctionRecommendationsResponse]
$creadListPrec :: ReadPrec [ExportLambdaFunctionRecommendationsResponse]
readPrec :: ReadPrec ExportLambdaFunctionRecommendationsResponse
$creadPrec :: ReadPrec ExportLambdaFunctionRecommendationsResponse
readList :: ReadS [ExportLambdaFunctionRecommendationsResponse]
$creadList :: ReadS [ExportLambdaFunctionRecommendationsResponse]
readsPrec :: Int -> ReadS ExportLambdaFunctionRecommendationsResponse
$creadsPrec :: Int -> ReadS ExportLambdaFunctionRecommendationsResponse
Prelude.Read, Int -> ExportLambdaFunctionRecommendationsResponse -> ShowS
[ExportLambdaFunctionRecommendationsResponse] -> ShowS
ExportLambdaFunctionRecommendationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportLambdaFunctionRecommendationsResponse] -> ShowS
$cshowList :: [ExportLambdaFunctionRecommendationsResponse] -> ShowS
show :: ExportLambdaFunctionRecommendationsResponse -> String
$cshow :: ExportLambdaFunctionRecommendationsResponse -> String
showsPrec :: Int -> ExportLambdaFunctionRecommendationsResponse -> ShowS
$cshowsPrec :: Int -> ExportLambdaFunctionRecommendationsResponse -> ShowS
Prelude.Show, forall x.
Rep ExportLambdaFunctionRecommendationsResponse x
-> ExportLambdaFunctionRecommendationsResponse
forall x.
ExportLambdaFunctionRecommendationsResponse
-> Rep ExportLambdaFunctionRecommendationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExportLambdaFunctionRecommendationsResponse x
-> ExportLambdaFunctionRecommendationsResponse
$cfrom :: forall x.
ExportLambdaFunctionRecommendationsResponse
-> Rep ExportLambdaFunctionRecommendationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ExportLambdaFunctionRecommendationsResponse' 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:
--
-- 'jobId', 'exportLambdaFunctionRecommendationsResponse_jobId' - The identification number of the export job.
--
-- Use the DescribeRecommendationExportJobs action, and specify the job ID
-- to view the status of an export job.
--
-- 's3Destination', 'exportLambdaFunctionRecommendationsResponse_s3Destination' - Undocumented member.
--
-- 'httpStatus', 'exportLambdaFunctionRecommendationsResponse_httpStatus' - The response's http status code.
newExportLambdaFunctionRecommendationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ExportLambdaFunctionRecommendationsResponse
newExportLambdaFunctionRecommendationsResponse :: Int -> ExportLambdaFunctionRecommendationsResponse
newExportLambdaFunctionRecommendationsResponse
  Int
pHttpStatus_ =
    ExportLambdaFunctionRecommendationsResponse'
      { $sel:jobId:ExportLambdaFunctionRecommendationsResponse' :: Maybe Text
jobId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:s3Destination:ExportLambdaFunctionRecommendationsResponse' :: Maybe S3Destination
s3Destination =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ExportLambdaFunctionRecommendationsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The identification number of the export job.
--
-- Use the DescribeRecommendationExportJobs action, and specify the job ID
-- to view the status of an export job.
exportLambdaFunctionRecommendationsResponse_jobId :: Lens.Lens' ExportLambdaFunctionRecommendationsResponse (Prelude.Maybe Prelude.Text)
exportLambdaFunctionRecommendationsResponse_jobId :: Lens' ExportLambdaFunctionRecommendationsResponse (Maybe Text)
exportLambdaFunctionRecommendationsResponse_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportLambdaFunctionRecommendationsResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:ExportLambdaFunctionRecommendationsResponse' :: ExportLambdaFunctionRecommendationsResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: ExportLambdaFunctionRecommendationsResponse
s@ExportLambdaFunctionRecommendationsResponse' {} Maybe Text
a -> ExportLambdaFunctionRecommendationsResponse
s {$sel:jobId:ExportLambdaFunctionRecommendationsResponse' :: Maybe Text
jobId = Maybe Text
a} :: ExportLambdaFunctionRecommendationsResponse)

-- | Undocumented member.
exportLambdaFunctionRecommendationsResponse_s3Destination :: Lens.Lens' ExportLambdaFunctionRecommendationsResponse (Prelude.Maybe S3Destination)
exportLambdaFunctionRecommendationsResponse_s3Destination :: Lens'
  ExportLambdaFunctionRecommendationsResponse (Maybe S3Destination)
exportLambdaFunctionRecommendationsResponse_s3Destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportLambdaFunctionRecommendationsResponse' {Maybe S3Destination
s3Destination :: Maybe S3Destination
$sel:s3Destination:ExportLambdaFunctionRecommendationsResponse' :: ExportLambdaFunctionRecommendationsResponse -> Maybe S3Destination
s3Destination} -> Maybe S3Destination
s3Destination) (\s :: ExportLambdaFunctionRecommendationsResponse
s@ExportLambdaFunctionRecommendationsResponse' {} Maybe S3Destination
a -> ExportLambdaFunctionRecommendationsResponse
s {$sel:s3Destination:ExportLambdaFunctionRecommendationsResponse' :: Maybe S3Destination
s3Destination = Maybe S3Destination
a} :: ExportLambdaFunctionRecommendationsResponse)

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

instance
  Prelude.NFData
    ExportLambdaFunctionRecommendationsResponse
  where
  rnf :: ExportLambdaFunctionRecommendationsResponse -> ()
rnf ExportLambdaFunctionRecommendationsResponse' {Int
Maybe Text
Maybe S3Destination
httpStatus :: Int
s3Destination :: Maybe S3Destination
jobId :: Maybe Text
$sel:httpStatus:ExportLambdaFunctionRecommendationsResponse' :: ExportLambdaFunctionRecommendationsResponse -> Int
$sel:s3Destination:ExportLambdaFunctionRecommendationsResponse' :: ExportLambdaFunctionRecommendationsResponse -> Maybe S3Destination
$sel:jobId:ExportLambdaFunctionRecommendationsResponse' :: ExportLambdaFunctionRecommendationsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3Destination
s3Destination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus