{-# 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.ExportECSServiceRecommendations
-- 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 ECS services on Fargate.
--
-- Recommendations are exported in a CSV file, and its metadata in a 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 only have one Amazon ECS service export job in progress per
-- Amazon Web Services Region.
module Amazonka.ComputeOptimizer.ExportECSServiceRecommendations
  ( -- * Creating a Request
    ExportECSServiceRecommendations (..),
    newExportECSServiceRecommendations,

    -- * Request Lenses
    exportECSServiceRecommendations_accountIds,
    exportECSServiceRecommendations_fieldsToExport,
    exportECSServiceRecommendations_fileFormat,
    exportECSServiceRecommendations_filters,
    exportECSServiceRecommendations_includeMemberAccounts,
    exportECSServiceRecommendations_s3DestinationConfig,

    -- * Destructuring the Response
    ExportECSServiceRecommendationsResponse (..),
    newExportECSServiceRecommendationsResponse,

    -- * Response Lenses
    exportECSServiceRecommendationsResponse_jobId,
    exportECSServiceRecommendationsResponse_s3Destination,
    exportECSServiceRecommendationsResponse_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:/ 'newExportECSServiceRecommendations' smart constructor.
data ExportECSServiceRecommendations = ExportECSServiceRecommendations'
  { -- | The Amazon Web Services account IDs for the export ECS service
    -- recommendations.
    --
    -- If your account is the management account or the delegated administrator
    -- of an organization, use this parameter to specify the member account you
    -- want to export recommendations to.
    --
    -- This parameter can\'t be specified together with the include member
    -- accounts parameter. The parameters are mutually exclusive.
    --
    -- If this parameter or the include member accounts parameter is omitted,
    -- the recommendations for member accounts aren\'t included in the export.
    --
    -- You can specify multiple account IDs per request.
    ExportECSServiceRecommendations -> 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/.
    ExportECSServiceRecommendations
-> Maybe [ExportableECSServiceField]
fieldsToExport :: Prelude.Maybe [ExportableECSServiceField],
    -- | The format of the export file.
    --
    -- The CSV file is the only export file format currently supported.
    ExportECSServiceRecommendations -> Maybe FileFormat
fileFormat :: Prelude.Maybe FileFormat,
    -- | An array of objects to specify a filter that exports a more specific set
    -- of ECS service recommendations.
    ExportECSServiceRecommendations
-> Maybe [ECSServiceRecommendationFilter]
filters :: Prelude.Maybe [ECSServiceRecommendationFilter],
    -- | If your account is the management account or the delegated administrator
    -- of an organization, this parameter indicates whether to include
    -- recommendations for resources in all member accounts of the
    -- 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/.
    --
    -- If this parameter is omitted, recommendations for member accounts of the
    -- organization aren\'t included in the export file.
    --
    -- If this parameter or the account ID parameter is omitted,
    -- recommendations for member accounts aren\'t included in the export.
    ExportECSServiceRecommendations -> Maybe Bool
includeMemberAccounts :: Prelude.Maybe Prelude.Bool,
    ExportECSServiceRecommendations -> S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
  }
  deriving (ExportECSServiceRecommendations
-> ExportECSServiceRecommendations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportECSServiceRecommendations
-> ExportECSServiceRecommendations -> Bool
$c/= :: ExportECSServiceRecommendations
-> ExportECSServiceRecommendations -> Bool
== :: ExportECSServiceRecommendations
-> ExportECSServiceRecommendations -> Bool
$c== :: ExportECSServiceRecommendations
-> ExportECSServiceRecommendations -> Bool
Prelude.Eq, ReadPrec [ExportECSServiceRecommendations]
ReadPrec ExportECSServiceRecommendations
Int -> ReadS ExportECSServiceRecommendations
ReadS [ExportECSServiceRecommendations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportECSServiceRecommendations]
$creadListPrec :: ReadPrec [ExportECSServiceRecommendations]
readPrec :: ReadPrec ExportECSServiceRecommendations
$creadPrec :: ReadPrec ExportECSServiceRecommendations
readList :: ReadS [ExportECSServiceRecommendations]
$creadList :: ReadS [ExportECSServiceRecommendations]
readsPrec :: Int -> ReadS ExportECSServiceRecommendations
$creadsPrec :: Int -> ReadS ExportECSServiceRecommendations
Prelude.Read, Int -> ExportECSServiceRecommendations -> ShowS
[ExportECSServiceRecommendations] -> ShowS
ExportECSServiceRecommendations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportECSServiceRecommendations] -> ShowS
$cshowList :: [ExportECSServiceRecommendations] -> ShowS
show :: ExportECSServiceRecommendations -> String
$cshow :: ExportECSServiceRecommendations -> String
showsPrec :: Int -> ExportECSServiceRecommendations -> ShowS
$cshowsPrec :: Int -> ExportECSServiceRecommendations -> ShowS
Prelude.Show, forall x.
Rep ExportECSServiceRecommendations x
-> ExportECSServiceRecommendations
forall x.
ExportECSServiceRecommendations
-> Rep ExportECSServiceRecommendations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExportECSServiceRecommendations x
-> ExportECSServiceRecommendations
$cfrom :: forall x.
ExportECSServiceRecommendations
-> Rep ExportECSServiceRecommendations x
Prelude.Generic)

-- |
-- Create a value of 'ExportECSServiceRecommendations' 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', 'exportECSServiceRecommendations_accountIds' - The Amazon Web Services account IDs for the export ECS service
-- recommendations.
--
-- If your account is the management account or the delegated administrator
-- of an organization, use this parameter to specify the member account you
-- want to export recommendations to.
--
-- This parameter can\'t be specified together with the include member
-- accounts parameter. The parameters are mutually exclusive.
--
-- If this parameter or the include member accounts parameter is omitted,
-- the recommendations for member accounts aren\'t included in the export.
--
-- You can specify multiple account IDs per request.
--
-- 'fieldsToExport', 'exportECSServiceRecommendations_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', 'exportECSServiceRecommendations_fileFormat' - The format of the export file.
--
-- The CSV file is the only export file format currently supported.
--
-- 'filters', 'exportECSServiceRecommendations_filters' - An array of objects to specify a filter that exports a more specific set
-- of ECS service recommendations.
--
-- 'includeMemberAccounts', 'exportECSServiceRecommendations_includeMemberAccounts' - If your account is the management account or the delegated administrator
-- of an organization, this parameter indicates whether to include
-- recommendations for resources in all member accounts of the
-- 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/.
--
-- If this parameter is omitted, recommendations for member accounts of the
-- organization aren\'t included in the export file.
--
-- If this parameter or the account ID parameter is omitted,
-- recommendations for member accounts aren\'t included in the export.
--
-- 's3DestinationConfig', 'exportECSServiceRecommendations_s3DestinationConfig' - Undocumented member.
newExportECSServiceRecommendations ::
  -- | 's3DestinationConfig'
  S3DestinationConfig ->
  ExportECSServiceRecommendations
newExportECSServiceRecommendations :: S3DestinationConfig -> ExportECSServiceRecommendations
newExportECSServiceRecommendations
  S3DestinationConfig
pS3DestinationConfig_ =
    ExportECSServiceRecommendations'
      { $sel:accountIds:ExportECSServiceRecommendations' :: Maybe [Text]
accountIds =
          forall a. Maybe a
Prelude.Nothing,
        $sel:fieldsToExport:ExportECSServiceRecommendations' :: Maybe [ExportableECSServiceField]
fieldsToExport = forall a. Maybe a
Prelude.Nothing,
        $sel:fileFormat:ExportECSServiceRecommendations' :: Maybe FileFormat
fileFormat = forall a. Maybe a
Prelude.Nothing,
        $sel:filters:ExportECSServiceRecommendations' :: Maybe [ECSServiceRecommendationFilter]
filters = forall a. Maybe a
Prelude.Nothing,
        $sel:includeMemberAccounts:ExportECSServiceRecommendations' :: Maybe Bool
includeMemberAccounts = forall a. Maybe a
Prelude.Nothing,
        $sel:s3DestinationConfig:ExportECSServiceRecommendations' :: S3DestinationConfig
s3DestinationConfig =
          S3DestinationConfig
pS3DestinationConfig_
      }

-- | The Amazon Web Services account IDs for the export ECS service
-- recommendations.
--
-- If your account is the management account or the delegated administrator
-- of an organization, use this parameter to specify the member account you
-- want to export recommendations to.
--
-- This parameter can\'t be specified together with the include member
-- accounts parameter. The parameters are mutually exclusive.
--
-- If this parameter or the include member accounts parameter is omitted,
-- the recommendations for member accounts aren\'t included in the export.
--
-- You can specify multiple account IDs per request.
exportECSServiceRecommendations_accountIds :: Lens.Lens' ExportECSServiceRecommendations (Prelude.Maybe [Prelude.Text])
exportECSServiceRecommendations_accountIds :: Lens' ExportECSServiceRecommendations (Maybe [Text])
exportECSServiceRecommendations_accountIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportECSServiceRecommendations' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> Maybe [Text]
accountIds} -> Maybe [Text]
accountIds) (\s :: ExportECSServiceRecommendations
s@ExportECSServiceRecommendations' {} Maybe [Text]
a -> ExportECSServiceRecommendations
s {$sel:accountIds:ExportECSServiceRecommendations' :: Maybe [Text]
accountIds = Maybe [Text]
a} :: ExportECSServiceRecommendations) 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/.
exportECSServiceRecommendations_fieldsToExport :: Lens.Lens' ExportECSServiceRecommendations (Prelude.Maybe [ExportableECSServiceField])
exportECSServiceRecommendations_fieldsToExport :: Lens'
  ExportECSServiceRecommendations (Maybe [ExportableECSServiceField])
exportECSServiceRecommendations_fieldsToExport = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportECSServiceRecommendations' {Maybe [ExportableECSServiceField]
fieldsToExport :: Maybe [ExportableECSServiceField]
$sel:fieldsToExport:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations
-> Maybe [ExportableECSServiceField]
fieldsToExport} -> Maybe [ExportableECSServiceField]
fieldsToExport) (\s :: ExportECSServiceRecommendations
s@ExportECSServiceRecommendations' {} Maybe [ExportableECSServiceField]
a -> ExportECSServiceRecommendations
s {$sel:fieldsToExport:ExportECSServiceRecommendations' :: Maybe [ExportableECSServiceField]
fieldsToExport = Maybe [ExportableECSServiceField]
a} :: ExportECSServiceRecommendations) 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 CSV file is the only export file format currently supported.
exportECSServiceRecommendations_fileFormat :: Lens.Lens' ExportECSServiceRecommendations (Prelude.Maybe FileFormat)
exportECSServiceRecommendations_fileFormat :: Lens' ExportECSServiceRecommendations (Maybe FileFormat)
exportECSServiceRecommendations_fileFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportECSServiceRecommendations' {Maybe FileFormat
fileFormat :: Maybe FileFormat
$sel:fileFormat:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> Maybe FileFormat
fileFormat} -> Maybe FileFormat
fileFormat) (\s :: ExportECSServiceRecommendations
s@ExportECSServiceRecommendations' {} Maybe FileFormat
a -> ExportECSServiceRecommendations
s {$sel:fileFormat:ExportECSServiceRecommendations' :: Maybe FileFormat
fileFormat = Maybe FileFormat
a} :: ExportECSServiceRecommendations)

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

-- | If your account is the management account or the delegated administrator
-- of an organization, this parameter indicates whether to include
-- recommendations for resources in all member accounts of the
-- 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/.
--
-- If this parameter is omitted, recommendations for member accounts of the
-- organization aren\'t included in the export file.
--
-- If this parameter or the account ID parameter is omitted,
-- recommendations for member accounts aren\'t included in the export.
exportECSServiceRecommendations_includeMemberAccounts :: Lens.Lens' ExportECSServiceRecommendations (Prelude.Maybe Prelude.Bool)
exportECSServiceRecommendations_includeMemberAccounts :: Lens' ExportECSServiceRecommendations (Maybe Bool)
exportECSServiceRecommendations_includeMemberAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportECSServiceRecommendations' {Maybe Bool
includeMemberAccounts :: Maybe Bool
$sel:includeMemberAccounts:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> Maybe Bool
includeMemberAccounts} -> Maybe Bool
includeMemberAccounts) (\s :: ExportECSServiceRecommendations
s@ExportECSServiceRecommendations' {} Maybe Bool
a -> ExportECSServiceRecommendations
s {$sel:includeMemberAccounts:ExportECSServiceRecommendations' :: Maybe Bool
includeMemberAccounts = Maybe Bool
a} :: ExportECSServiceRecommendations)

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

instance
  Core.AWSRequest
    ExportECSServiceRecommendations
  where
  type
    AWSResponse ExportECSServiceRecommendations =
      ExportECSServiceRecommendationsResponse
  request :: (Service -> Service)
-> ExportECSServiceRecommendations
-> Request ExportECSServiceRecommendations
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 ExportECSServiceRecommendations
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ExportECSServiceRecommendations)))
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
-> ExportECSServiceRecommendationsResponse
ExportECSServiceRecommendationsResponse'
            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
    ExportECSServiceRecommendations
  where
  hashWithSalt :: Int -> ExportECSServiceRecommendations -> Int
hashWithSalt
    Int
_salt
    ExportECSServiceRecommendations' {Maybe Bool
Maybe [Text]
Maybe [ECSServiceRecommendationFilter]
Maybe [ExportableECSServiceField]
Maybe FileFormat
S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
includeMemberAccounts :: Maybe Bool
filters :: Maybe [ECSServiceRecommendationFilter]
fileFormat :: Maybe FileFormat
fieldsToExport :: Maybe [ExportableECSServiceField]
accountIds :: Maybe [Text]
$sel:s3DestinationConfig:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> S3DestinationConfig
$sel:includeMemberAccounts:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> Maybe Bool
$sel:filters:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations
-> Maybe [ECSServiceRecommendationFilter]
$sel:fileFormat:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> Maybe FileFormat
$sel:fieldsToExport:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations
-> Maybe [ExportableECSServiceField]
$sel:accountIds:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> 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 [ExportableECSServiceField]
fieldsToExport
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FileFormat
fileFormat
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ECSServiceRecommendationFilter]
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
    ExportECSServiceRecommendations
  where
  rnf :: ExportECSServiceRecommendations -> ()
rnf ExportECSServiceRecommendations' {Maybe Bool
Maybe [Text]
Maybe [ECSServiceRecommendationFilter]
Maybe [ExportableECSServiceField]
Maybe FileFormat
S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
includeMemberAccounts :: Maybe Bool
filters :: Maybe [ECSServiceRecommendationFilter]
fileFormat :: Maybe FileFormat
fieldsToExport :: Maybe [ExportableECSServiceField]
accountIds :: Maybe [Text]
$sel:s3DestinationConfig:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> S3DestinationConfig
$sel:includeMemberAccounts:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> Maybe Bool
$sel:filters:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations
-> Maybe [ECSServiceRecommendationFilter]
$sel:fileFormat:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> Maybe FileFormat
$sel:fieldsToExport:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations
-> Maybe [ExportableECSServiceField]
$sel:accountIds:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> 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 [ExportableECSServiceField]
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 [ECSServiceRecommendationFilter]
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
    ExportECSServiceRecommendations
  where
  toHeaders :: ExportECSServiceRecommendations -> 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.ExportECSServiceRecommendations" ::
                          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 ExportECSServiceRecommendations where
  toJSON :: ExportECSServiceRecommendations -> Value
toJSON ExportECSServiceRecommendations' {Maybe Bool
Maybe [Text]
Maybe [ECSServiceRecommendationFilter]
Maybe [ExportableECSServiceField]
Maybe FileFormat
S3DestinationConfig
s3DestinationConfig :: S3DestinationConfig
includeMemberAccounts :: Maybe Bool
filters :: Maybe [ECSServiceRecommendationFilter]
fileFormat :: Maybe FileFormat
fieldsToExport :: Maybe [ExportableECSServiceField]
accountIds :: Maybe [Text]
$sel:s3DestinationConfig:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> S3DestinationConfig
$sel:includeMemberAccounts:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> Maybe Bool
$sel:filters:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations
-> Maybe [ECSServiceRecommendationFilter]
$sel:fileFormat:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> Maybe FileFormat
$sel:fieldsToExport:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations
-> Maybe [ExportableECSServiceField]
$sel:accountIds:ExportECSServiceRecommendations' :: ExportECSServiceRecommendations -> 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 [ExportableECSServiceField]
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 [ECSServiceRecommendationFilter]
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 ExportECSServiceRecommendations where
  toPath :: ExportECSServiceRecommendations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ExportECSServiceRecommendationsResponse' 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', 'exportECSServiceRecommendationsResponse_jobId' - The identification number of the export job.
--
-- To view the status of an export job, use the
-- DescribeRecommendationExportJobs action and specify the job ID.
--
-- 's3Destination', 'exportECSServiceRecommendationsResponse_s3Destination' - Undocumented member.
--
-- 'httpStatus', 'exportECSServiceRecommendationsResponse_httpStatus' - The response's http status code.
newExportECSServiceRecommendationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ExportECSServiceRecommendationsResponse
newExportECSServiceRecommendationsResponse :: Int -> ExportECSServiceRecommendationsResponse
newExportECSServiceRecommendationsResponse
  Int
pHttpStatus_ =
    ExportECSServiceRecommendationsResponse'
      { $sel:jobId:ExportECSServiceRecommendationsResponse' :: Maybe Text
jobId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:s3Destination:ExportECSServiceRecommendationsResponse' :: Maybe S3Destination
s3Destination = forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ExportECSServiceRecommendationsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

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

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

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

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