{-# 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.ExportEC2InstanceRecommendations
-- 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 Amazon EC2 instances.
--
-- 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 Amazon EC2 instance export job in progress per
-- Amazon Web Services Region.
module Amazonka.ComputeOptimizer.ExportEC2InstanceRecommendations
  ( -- * Creating a Request
    ExportEC2InstanceRecommendations (..),
    newExportEC2InstanceRecommendations,

    -- * Request Lenses
    exportEC2InstanceRecommendations_accountIds,
    exportEC2InstanceRecommendations_fieldsToExport,
    exportEC2InstanceRecommendations_fileFormat,
    exportEC2InstanceRecommendations_filters,
    exportEC2InstanceRecommendations_includeMemberAccounts,
    exportEC2InstanceRecommendations_recommendationPreferences,
    exportEC2InstanceRecommendations_s3DestinationConfig,

    -- * Destructuring the Response
    ExportEC2InstanceRecommendationsResponse (..),
    newExportEC2InstanceRecommendationsResponse,

    -- * Response Lenses
    exportEC2InstanceRecommendationsResponse_jobId,
    exportEC2InstanceRecommendationsResponse_s3Destination,
    exportEC2InstanceRecommendationsResponse_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:/ 'newExportEC2InstanceRecommendations' smart constructor.
data ExportEC2InstanceRecommendations = ExportEC2InstanceRecommendations'
  { -- | The IDs of the Amazon Web Services accounts for which to export instance
    -- 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.
    ExportEC2InstanceRecommendations -> 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/.
    ExportEC2InstanceRecommendations -> Maybe [ExportableInstanceField]
fieldsToExport :: Prelude.Maybe [ExportableInstanceField],
    -- | The format of the export file.
    --
    -- The only export file format currently supported is @Csv@.
    ExportEC2InstanceRecommendations -> Maybe FileFormat
fileFormat :: Prelude.Maybe FileFormat,
    -- | An array of objects to specify a filter that exports a more specific set
    -- of instance recommendations.
    ExportEC2InstanceRecommendations -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | 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.
    --
    -- Recommendations for member accounts are not included in the export if
    -- this parameter, or the account IDs parameter, is omitted.
    ExportEC2InstanceRecommendations -> Maybe Bool
includeMemberAccounts :: Prelude.Maybe Prelude.Bool,
    -- | An object to specify the preferences for the Amazon EC2 instance
    -- recommendations to export.
    ExportEC2InstanceRecommendations -> Maybe RecommendationPreferences
recommendationPreferences :: Prelude.Maybe RecommendationPreferences,
    -- | An object to specify the destination Amazon Simple Storage Service
    -- (Amazon S3) bucket name and key prefix for the export job.
    --
    -- You must create the destination Amazon S3 bucket for your
    -- recommendations export before you create the export job. Compute
    -- Optimizer does not create the S3 bucket for you. After you create the S3
    -- bucket, ensure that it has the required permissions policy to allow
    -- Compute Optimizer to write the export file to it. If you plan to specify
    -- an object prefix when you create the export job, you must include the
    -- object prefix in the policy that you add to the S3 bucket. For more
    -- information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/create-s3-bucket-policy-for-compute-optimizer.html Amazon S3 Bucket Policy for Compute Optimizer>
    -- in the /Compute Optimizer User Guide/.
    ExportEC2InstanceRecommendations -> S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
  }
  deriving (ExportEC2InstanceRecommendations
-> ExportEC2InstanceRecommendations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportEC2InstanceRecommendations
-> ExportEC2InstanceRecommendations -> Bool
$c/= :: ExportEC2InstanceRecommendations
-> ExportEC2InstanceRecommendations -> Bool
== :: ExportEC2InstanceRecommendations
-> ExportEC2InstanceRecommendations -> Bool
$c== :: ExportEC2InstanceRecommendations
-> ExportEC2InstanceRecommendations -> Bool
Prelude.Eq, ReadPrec [ExportEC2InstanceRecommendations]
ReadPrec ExportEC2InstanceRecommendations
Int -> ReadS ExportEC2InstanceRecommendations
ReadS [ExportEC2InstanceRecommendations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportEC2InstanceRecommendations]
$creadListPrec :: ReadPrec [ExportEC2InstanceRecommendations]
readPrec :: ReadPrec ExportEC2InstanceRecommendations
$creadPrec :: ReadPrec ExportEC2InstanceRecommendations
readList :: ReadS [ExportEC2InstanceRecommendations]
$creadList :: ReadS [ExportEC2InstanceRecommendations]
readsPrec :: Int -> ReadS ExportEC2InstanceRecommendations
$creadsPrec :: Int -> ReadS ExportEC2InstanceRecommendations
Prelude.Read, Int -> ExportEC2InstanceRecommendations -> ShowS
[ExportEC2InstanceRecommendations] -> ShowS
ExportEC2InstanceRecommendations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportEC2InstanceRecommendations] -> ShowS
$cshowList :: [ExportEC2InstanceRecommendations] -> ShowS
show :: ExportEC2InstanceRecommendations -> String
$cshow :: ExportEC2InstanceRecommendations -> String
showsPrec :: Int -> ExportEC2InstanceRecommendations -> ShowS
$cshowsPrec :: Int -> ExportEC2InstanceRecommendations -> ShowS
Prelude.Show, forall x.
Rep ExportEC2InstanceRecommendations x
-> ExportEC2InstanceRecommendations
forall x.
ExportEC2InstanceRecommendations
-> Rep ExportEC2InstanceRecommendations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExportEC2InstanceRecommendations x
-> ExportEC2InstanceRecommendations
$cfrom :: forall x.
ExportEC2InstanceRecommendations
-> Rep ExportEC2InstanceRecommendations x
Prelude.Generic)

-- |
-- Create a value of 'ExportEC2InstanceRecommendations' 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', 'exportEC2InstanceRecommendations_accountIds' - The IDs of the Amazon Web Services accounts for which to export instance
-- 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', 'exportEC2InstanceRecommendations_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', 'exportEC2InstanceRecommendations_fileFormat' - The format of the export file.
--
-- The only export file format currently supported is @Csv@.
--
-- 'filters', 'exportEC2InstanceRecommendations_filters' - An array of objects to specify a filter that exports a more specific set
-- of instance recommendations.
--
-- 'includeMemberAccounts', 'exportEC2InstanceRecommendations_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.
--
-- Recommendations for member accounts are not included in the export if
-- this parameter, or the account IDs parameter, is omitted.
--
-- 'recommendationPreferences', 'exportEC2InstanceRecommendations_recommendationPreferences' - An object to specify the preferences for the Amazon EC2 instance
-- recommendations to export.
--
-- 's3DestinationConfig', 'exportEC2InstanceRecommendations_s3DestinationConfig' - An object to specify the destination Amazon Simple Storage Service
-- (Amazon S3) bucket name and key prefix for the export job.
--
-- You must create the destination Amazon S3 bucket for your
-- recommendations export before you create the export job. Compute
-- Optimizer does not create the S3 bucket for you. After you create the S3
-- bucket, ensure that it has the required permissions policy to allow
-- Compute Optimizer to write the export file to it. If you plan to specify
-- an object prefix when you create the export job, you must include the
-- object prefix in the policy that you add to the S3 bucket. For more
-- information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/create-s3-bucket-policy-for-compute-optimizer.html Amazon S3 Bucket Policy for Compute Optimizer>
-- in the /Compute Optimizer User Guide/.
newExportEC2InstanceRecommendations ::
  -- | 's3DestinationConfig'
  S3DestinationConfig ->
  ExportEC2InstanceRecommendations
newExportEC2InstanceRecommendations :: S3DestinationConfig -> ExportEC2InstanceRecommendations
newExportEC2InstanceRecommendations
  S3DestinationConfig
pS3DestinationConfig_ =
    ExportEC2InstanceRecommendations'
      { $sel:accountIds:ExportEC2InstanceRecommendations' :: Maybe [Text]
accountIds =
          forall a. Maybe a
Prelude.Nothing,
        $sel:fieldsToExport:ExportEC2InstanceRecommendations' :: Maybe [ExportableInstanceField]
fieldsToExport = forall a. Maybe a
Prelude.Nothing,
        $sel:fileFormat:ExportEC2InstanceRecommendations' :: Maybe FileFormat
fileFormat = forall a. Maybe a
Prelude.Nothing,
        $sel:filters:ExportEC2InstanceRecommendations' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
        $sel:includeMemberAccounts:ExportEC2InstanceRecommendations' :: Maybe Bool
includeMemberAccounts = forall a. Maybe a
Prelude.Nothing,
        $sel:recommendationPreferences:ExportEC2InstanceRecommendations' :: Maybe RecommendationPreferences
recommendationPreferences =
          forall a. Maybe a
Prelude.Nothing,
        $sel:s3DestinationConfig:ExportEC2InstanceRecommendations' :: S3DestinationConfig
s3DestinationConfig =
          S3DestinationConfig
pS3DestinationConfig_
      }

-- | The IDs of the Amazon Web Services accounts for which to export instance
-- 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.
exportEC2InstanceRecommendations_accountIds :: Lens.Lens' ExportEC2InstanceRecommendations (Prelude.Maybe [Prelude.Text])
exportEC2InstanceRecommendations_accountIds :: Lens' ExportEC2InstanceRecommendations (Maybe [Text])
exportEC2InstanceRecommendations_accountIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportEC2InstanceRecommendations' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe [Text]
accountIds} -> Maybe [Text]
accountIds) (\s :: ExportEC2InstanceRecommendations
s@ExportEC2InstanceRecommendations' {} Maybe [Text]
a -> ExportEC2InstanceRecommendations
s {$sel:accountIds:ExportEC2InstanceRecommendations' :: Maybe [Text]
accountIds = Maybe [Text]
a} :: ExportEC2InstanceRecommendations) 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/.
exportEC2InstanceRecommendations_fieldsToExport :: Lens.Lens' ExportEC2InstanceRecommendations (Prelude.Maybe [ExportableInstanceField])
exportEC2InstanceRecommendations_fieldsToExport :: Lens'
  ExportEC2InstanceRecommendations (Maybe [ExportableInstanceField])
exportEC2InstanceRecommendations_fieldsToExport = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportEC2InstanceRecommendations' {Maybe [ExportableInstanceField]
fieldsToExport :: Maybe [ExportableInstanceField]
$sel:fieldsToExport:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe [ExportableInstanceField]
fieldsToExport} -> Maybe [ExportableInstanceField]
fieldsToExport) (\s :: ExportEC2InstanceRecommendations
s@ExportEC2InstanceRecommendations' {} Maybe [ExportableInstanceField]
a -> ExportEC2InstanceRecommendations
s {$sel:fieldsToExport:ExportEC2InstanceRecommendations' :: Maybe [ExportableInstanceField]
fieldsToExport = Maybe [ExportableInstanceField]
a} :: ExportEC2InstanceRecommendations) 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@.
exportEC2InstanceRecommendations_fileFormat :: Lens.Lens' ExportEC2InstanceRecommendations (Prelude.Maybe FileFormat)
exportEC2InstanceRecommendations_fileFormat :: Lens' ExportEC2InstanceRecommendations (Maybe FileFormat)
exportEC2InstanceRecommendations_fileFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportEC2InstanceRecommendations' {Maybe FileFormat
fileFormat :: Maybe FileFormat
$sel:fileFormat:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe FileFormat
fileFormat} -> Maybe FileFormat
fileFormat) (\s :: ExportEC2InstanceRecommendations
s@ExportEC2InstanceRecommendations' {} Maybe FileFormat
a -> ExportEC2InstanceRecommendations
s {$sel:fileFormat:ExportEC2InstanceRecommendations' :: Maybe FileFormat
fileFormat = Maybe FileFormat
a} :: ExportEC2InstanceRecommendations)

-- | An array of objects to specify a filter that exports a more specific set
-- of instance recommendations.
exportEC2InstanceRecommendations_filters :: Lens.Lens' ExportEC2InstanceRecommendations (Prelude.Maybe [Filter])
exportEC2InstanceRecommendations_filters :: Lens' ExportEC2InstanceRecommendations (Maybe [Filter])
exportEC2InstanceRecommendations_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportEC2InstanceRecommendations' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ExportEC2InstanceRecommendations
s@ExportEC2InstanceRecommendations' {} Maybe [Filter]
a -> ExportEC2InstanceRecommendations
s {$sel:filters:ExportEC2InstanceRecommendations' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ExportEC2InstanceRecommendations) 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.
--
-- Recommendations for member accounts are not included in the export if
-- this parameter, or the account IDs parameter, is omitted.
exportEC2InstanceRecommendations_includeMemberAccounts :: Lens.Lens' ExportEC2InstanceRecommendations (Prelude.Maybe Prelude.Bool)
exportEC2InstanceRecommendations_includeMemberAccounts :: Lens' ExportEC2InstanceRecommendations (Maybe Bool)
exportEC2InstanceRecommendations_includeMemberAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportEC2InstanceRecommendations' {Maybe Bool
includeMemberAccounts :: Maybe Bool
$sel:includeMemberAccounts:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe Bool
includeMemberAccounts} -> Maybe Bool
includeMemberAccounts) (\s :: ExportEC2InstanceRecommendations
s@ExportEC2InstanceRecommendations' {} Maybe Bool
a -> ExportEC2InstanceRecommendations
s {$sel:includeMemberAccounts:ExportEC2InstanceRecommendations' :: Maybe Bool
includeMemberAccounts = Maybe Bool
a} :: ExportEC2InstanceRecommendations)

-- | An object to specify the preferences for the Amazon EC2 instance
-- recommendations to export.
exportEC2InstanceRecommendations_recommendationPreferences :: Lens.Lens' ExportEC2InstanceRecommendations (Prelude.Maybe RecommendationPreferences)
exportEC2InstanceRecommendations_recommendationPreferences :: Lens'
  ExportEC2InstanceRecommendations (Maybe RecommendationPreferences)
exportEC2InstanceRecommendations_recommendationPreferences = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportEC2InstanceRecommendations' {Maybe RecommendationPreferences
recommendationPreferences :: Maybe RecommendationPreferences
$sel:recommendationPreferences:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe RecommendationPreferences
recommendationPreferences} -> Maybe RecommendationPreferences
recommendationPreferences) (\s :: ExportEC2InstanceRecommendations
s@ExportEC2InstanceRecommendations' {} Maybe RecommendationPreferences
a -> ExportEC2InstanceRecommendations
s {$sel:recommendationPreferences:ExportEC2InstanceRecommendations' :: Maybe RecommendationPreferences
recommendationPreferences = Maybe RecommendationPreferences
a} :: ExportEC2InstanceRecommendations)

-- | An object to specify the destination Amazon Simple Storage Service
-- (Amazon S3) bucket name and key prefix for the export job.
--
-- You must create the destination Amazon S3 bucket for your
-- recommendations export before you create the export job. Compute
-- Optimizer does not create the S3 bucket for you. After you create the S3
-- bucket, ensure that it has the required permissions policy to allow
-- Compute Optimizer to write the export file to it. If you plan to specify
-- an object prefix when you create the export job, you must include the
-- object prefix in the policy that you add to the S3 bucket. For more
-- information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/create-s3-bucket-policy-for-compute-optimizer.html Amazon S3 Bucket Policy for Compute Optimizer>
-- in the /Compute Optimizer User Guide/.
exportEC2InstanceRecommendations_s3DestinationConfig :: Lens.Lens' ExportEC2InstanceRecommendations S3DestinationConfig
exportEC2InstanceRecommendations_s3DestinationConfig :: Lens' ExportEC2InstanceRecommendations S3DestinationConfig
exportEC2InstanceRecommendations_s3DestinationConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportEC2InstanceRecommendations' {S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
$sel:s3DestinationConfig:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> S3DestinationConfig
s3DestinationConfig} -> S3DestinationConfig
s3DestinationConfig) (\s :: ExportEC2InstanceRecommendations
s@ExportEC2InstanceRecommendations' {} S3DestinationConfig
a -> ExportEC2InstanceRecommendations
s {$sel:s3DestinationConfig:ExportEC2InstanceRecommendations' :: S3DestinationConfig
s3DestinationConfig = S3DestinationConfig
a} :: ExportEC2InstanceRecommendations)

instance
  Core.AWSRequest
    ExportEC2InstanceRecommendations
  where
  type
    AWSResponse ExportEC2InstanceRecommendations =
      ExportEC2InstanceRecommendationsResponse
  request :: (Service -> Service)
-> ExportEC2InstanceRecommendations
-> Request ExportEC2InstanceRecommendations
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 ExportEC2InstanceRecommendations
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ExportEC2InstanceRecommendations)))
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
-> ExportEC2InstanceRecommendationsResponse
ExportEC2InstanceRecommendationsResponse'
            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
    ExportEC2InstanceRecommendations
  where
  hashWithSalt :: Int -> ExportEC2InstanceRecommendations -> Int
hashWithSalt
    Int
_salt
    ExportEC2InstanceRecommendations' {Maybe Bool
Maybe [Text]
Maybe [ExportableInstanceField]
Maybe [Filter]
Maybe FileFormat
Maybe RecommendationPreferences
S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
recommendationPreferences :: Maybe RecommendationPreferences
includeMemberAccounts :: Maybe Bool
filters :: Maybe [Filter]
fileFormat :: Maybe FileFormat
fieldsToExport :: Maybe [ExportableInstanceField]
accountIds :: Maybe [Text]
$sel:s3DestinationConfig:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> S3DestinationConfig
$sel:recommendationPreferences:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe RecommendationPreferences
$sel:includeMemberAccounts:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe Bool
$sel:filters:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe [Filter]
$sel:fileFormat:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe FileFormat
$sel:fieldsToExport:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe [ExportableInstanceField]
$sel:accountIds:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> 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 [ExportableInstanceField]
fieldsToExport
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FileFormat
fileFormat
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Filter]
filters
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
includeMemberAccounts
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RecommendationPreferences
recommendationPreferences
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3DestinationConfig
s3DestinationConfig

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

instance
  Data.ToHeaders
    ExportEC2InstanceRecommendations
  where
  toHeaders :: ExportEC2InstanceRecommendations -> 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.ExportEC2InstanceRecommendations" ::
                          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 ExportEC2InstanceRecommendations where
  toJSON :: ExportEC2InstanceRecommendations -> Value
toJSON ExportEC2InstanceRecommendations' {Maybe Bool
Maybe [Text]
Maybe [ExportableInstanceField]
Maybe [Filter]
Maybe FileFormat
Maybe RecommendationPreferences
S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
recommendationPreferences :: Maybe RecommendationPreferences
includeMemberAccounts :: Maybe Bool
filters :: Maybe [Filter]
fileFormat :: Maybe FileFormat
fieldsToExport :: Maybe [ExportableInstanceField]
accountIds :: Maybe [Text]
$sel:s3DestinationConfig:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> S3DestinationConfig
$sel:recommendationPreferences:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe RecommendationPreferences
$sel:includeMemberAccounts:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe Bool
$sel:filters:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe [Filter]
$sel:fileFormat:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe FileFormat
$sel:fieldsToExport:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> Maybe [ExportableInstanceField]
$sel:accountIds:ExportEC2InstanceRecommendations' :: ExportEC2InstanceRecommendations -> 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 [ExportableInstanceField]
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 [Filter]
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,
            (Key
"recommendationPreferences" 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 RecommendationPreferences
recommendationPreferences,
            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 ExportEC2InstanceRecommendations where
  toPath :: ExportEC2InstanceRecommendations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ExportEC2InstanceRecommendationsResponse' 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', 'exportEC2InstanceRecommendationsResponse_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', 'exportEC2InstanceRecommendationsResponse_s3Destination' - An object that describes the destination Amazon S3 bucket of a
-- recommendations export file.
--
-- 'httpStatus', 'exportEC2InstanceRecommendationsResponse_httpStatus' - The response's http status code.
newExportEC2InstanceRecommendationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ExportEC2InstanceRecommendationsResponse
newExportEC2InstanceRecommendationsResponse :: Int -> ExportEC2InstanceRecommendationsResponse
newExportEC2InstanceRecommendationsResponse
  Int
pHttpStatus_ =
    ExportEC2InstanceRecommendationsResponse'
      { $sel:jobId:ExportEC2InstanceRecommendationsResponse' :: Maybe Text
jobId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:s3Destination:ExportEC2InstanceRecommendationsResponse' :: Maybe S3Destination
s3Destination = forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ExportEC2InstanceRecommendationsResponse' :: 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.
exportEC2InstanceRecommendationsResponse_jobId :: Lens.Lens' ExportEC2InstanceRecommendationsResponse (Prelude.Maybe Prelude.Text)
exportEC2InstanceRecommendationsResponse_jobId :: Lens' ExportEC2InstanceRecommendationsResponse (Maybe Text)
exportEC2InstanceRecommendationsResponse_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportEC2InstanceRecommendationsResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:ExportEC2InstanceRecommendationsResponse' :: ExportEC2InstanceRecommendationsResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: ExportEC2InstanceRecommendationsResponse
s@ExportEC2InstanceRecommendationsResponse' {} Maybe Text
a -> ExportEC2InstanceRecommendationsResponse
s {$sel:jobId:ExportEC2InstanceRecommendationsResponse' :: Maybe Text
jobId = Maybe Text
a} :: ExportEC2InstanceRecommendationsResponse)

-- | An object that describes the destination Amazon S3 bucket of a
-- recommendations export file.
exportEC2InstanceRecommendationsResponse_s3Destination :: Lens.Lens' ExportEC2InstanceRecommendationsResponse (Prelude.Maybe S3Destination)
exportEC2InstanceRecommendationsResponse_s3Destination :: Lens'
  ExportEC2InstanceRecommendationsResponse (Maybe S3Destination)
exportEC2InstanceRecommendationsResponse_s3Destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportEC2InstanceRecommendationsResponse' {Maybe S3Destination
s3Destination :: Maybe S3Destination
$sel:s3Destination:ExportEC2InstanceRecommendationsResponse' :: ExportEC2InstanceRecommendationsResponse -> Maybe S3Destination
s3Destination} -> Maybe S3Destination
s3Destination) (\s :: ExportEC2InstanceRecommendationsResponse
s@ExportEC2InstanceRecommendationsResponse' {} Maybe S3Destination
a -> ExportEC2InstanceRecommendationsResponse
s {$sel:s3Destination:ExportEC2InstanceRecommendationsResponse' :: Maybe S3Destination
s3Destination = Maybe S3Destination
a} :: ExportEC2InstanceRecommendationsResponse)

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

instance
  Prelude.NFData
    ExportEC2InstanceRecommendationsResponse
  where
  rnf :: ExportEC2InstanceRecommendationsResponse -> ()
rnf ExportEC2InstanceRecommendationsResponse' {Int
Maybe Text
Maybe S3Destination
httpStatus :: Int
s3Destination :: Maybe S3Destination
jobId :: Maybe Text
$sel:httpStatus:ExportEC2InstanceRecommendationsResponse' :: ExportEC2InstanceRecommendationsResponse -> Int
$sel:s3Destination:ExportEC2InstanceRecommendationsResponse' :: ExportEC2InstanceRecommendationsResponse -> Maybe S3Destination
$sel:jobId:ExportEC2InstanceRecommendationsResponse' :: ExportEC2InstanceRecommendationsResponse -> 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