{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.ExportDestination
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ComputeOptimizer.Types.ExportDestination where

import Amazonka.ComputeOptimizer.Types.S3Destination
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the destination of the recommendations export and metadata
-- files.
--
-- /See:/ 'newExportDestination' smart constructor.
data ExportDestination = ExportDestination'
  { -- | An object that describes the destination Amazon Simple Storage Service
    -- (Amazon S3) bucket name and object keys of a recommendations export
    -- file, and its associated metadata file.
    ExportDestination -> Maybe S3Destination
s3 :: Prelude.Maybe S3Destination
  }
  deriving (ExportDestination -> ExportDestination -> Bool
(ExportDestination -> ExportDestination -> Bool)
-> (ExportDestination -> ExportDestination -> Bool)
-> Eq ExportDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportDestination -> ExportDestination -> Bool
$c/= :: ExportDestination -> ExportDestination -> Bool
== :: ExportDestination -> ExportDestination -> Bool
$c== :: ExportDestination -> ExportDestination -> Bool
Prelude.Eq, ReadPrec [ExportDestination]
ReadPrec ExportDestination
Int -> ReadS ExportDestination
ReadS [ExportDestination]
(Int -> ReadS ExportDestination)
-> ReadS [ExportDestination]
-> ReadPrec ExportDestination
-> ReadPrec [ExportDestination]
-> Read ExportDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportDestination]
$creadListPrec :: ReadPrec [ExportDestination]
readPrec :: ReadPrec ExportDestination
$creadPrec :: ReadPrec ExportDestination
readList :: ReadS [ExportDestination]
$creadList :: ReadS [ExportDestination]
readsPrec :: Int -> ReadS ExportDestination
$creadsPrec :: Int -> ReadS ExportDestination
Prelude.Read, Int -> ExportDestination -> ShowS
[ExportDestination] -> ShowS
ExportDestination -> String
(Int -> ExportDestination -> ShowS)
-> (ExportDestination -> String)
-> ([ExportDestination] -> ShowS)
-> Show ExportDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportDestination] -> ShowS
$cshowList :: [ExportDestination] -> ShowS
show :: ExportDestination -> String
$cshow :: ExportDestination -> String
showsPrec :: Int -> ExportDestination -> ShowS
$cshowsPrec :: Int -> ExportDestination -> ShowS
Prelude.Show, (forall x. ExportDestination -> Rep ExportDestination x)
-> (forall x. Rep ExportDestination x -> ExportDestination)
-> Generic ExportDestination
forall x. Rep ExportDestination x -> ExportDestination
forall x. ExportDestination -> Rep ExportDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportDestination x -> ExportDestination
$cfrom :: forall x. ExportDestination -> Rep ExportDestination x
Prelude.Generic)

-- |
-- Create a value of 'ExportDestination' 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:
--
-- 's3', 'exportDestination_s3' - An object that describes the destination Amazon Simple Storage Service
-- (Amazon S3) bucket name and object keys of a recommendations export
-- file, and its associated metadata file.
newExportDestination ::
  ExportDestination
newExportDestination :: ExportDestination
newExportDestination =
  ExportDestination' :: Maybe S3Destination -> ExportDestination
ExportDestination' {$sel:s3:ExportDestination' :: Maybe S3Destination
s3 = Maybe S3Destination
forall a. Maybe a
Prelude.Nothing}

-- | An object that describes the destination Amazon Simple Storage Service
-- (Amazon S3) bucket name and object keys of a recommendations export
-- file, and its associated metadata file.
exportDestination_s3 :: Lens.Lens' ExportDestination (Prelude.Maybe S3Destination)
exportDestination_s3 :: (Maybe S3Destination -> f (Maybe S3Destination))
-> ExportDestination -> f ExportDestination
exportDestination_s3 = (ExportDestination -> Maybe S3Destination)
-> (ExportDestination -> Maybe S3Destination -> ExportDestination)
-> Lens
     ExportDestination
     ExportDestination
     (Maybe S3Destination)
     (Maybe S3Destination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportDestination' {Maybe S3Destination
s3 :: Maybe S3Destination
$sel:s3:ExportDestination' :: ExportDestination -> Maybe S3Destination
s3} -> Maybe S3Destination
s3) (\s :: ExportDestination
s@ExportDestination' {} Maybe S3Destination
a -> ExportDestination
s {$sel:s3:ExportDestination' :: Maybe S3Destination
s3 = Maybe S3Destination
a} :: ExportDestination)

instance Core.FromJSON ExportDestination where
  parseJSON :: Value -> Parser ExportDestination
parseJSON =
    String
-> (Object -> Parser ExportDestination)
-> Value
-> Parser ExportDestination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExportDestination"
      ( \Object
x ->
          Maybe S3Destination -> ExportDestination
ExportDestination' (Maybe S3Destination -> ExportDestination)
-> Parser (Maybe S3Destination) -> Parser ExportDestination
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3Destination)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3")
      )

instance Prelude.Hashable ExportDestination

instance Prelude.NFData ExportDestination