{-# 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.QuickSight.Types.S3Parameters
-- 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.QuickSight.Types.S3Parameters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.ManifestFileLocation

-- | The parameters for S3.
--
-- /See:/ 'newS3Parameters' smart constructor.
data S3Parameters = S3Parameters'
  { -- | Location of the Amazon S3 manifest file. This is NULL if the manifest
    -- file was uploaded into Amazon QuickSight.
    S3Parameters -> ManifestFileLocation
manifestFileLocation :: ManifestFileLocation
  }
  deriving (S3Parameters -> S3Parameters -> Bool
(S3Parameters -> S3Parameters -> Bool)
-> (S3Parameters -> S3Parameters -> Bool) -> Eq S3Parameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3Parameters -> S3Parameters -> Bool
$c/= :: S3Parameters -> S3Parameters -> Bool
== :: S3Parameters -> S3Parameters -> Bool
$c== :: S3Parameters -> S3Parameters -> Bool
Prelude.Eq, ReadPrec [S3Parameters]
ReadPrec S3Parameters
Int -> ReadS S3Parameters
ReadS [S3Parameters]
(Int -> ReadS S3Parameters)
-> ReadS [S3Parameters]
-> ReadPrec S3Parameters
-> ReadPrec [S3Parameters]
-> Read S3Parameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3Parameters]
$creadListPrec :: ReadPrec [S3Parameters]
readPrec :: ReadPrec S3Parameters
$creadPrec :: ReadPrec S3Parameters
readList :: ReadS [S3Parameters]
$creadList :: ReadS [S3Parameters]
readsPrec :: Int -> ReadS S3Parameters
$creadsPrec :: Int -> ReadS S3Parameters
Prelude.Read, Int -> S3Parameters -> ShowS
[S3Parameters] -> ShowS
S3Parameters -> String
(Int -> S3Parameters -> ShowS)
-> (S3Parameters -> String)
-> ([S3Parameters] -> ShowS)
-> Show S3Parameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3Parameters] -> ShowS
$cshowList :: [S3Parameters] -> ShowS
show :: S3Parameters -> String
$cshow :: S3Parameters -> String
showsPrec :: Int -> S3Parameters -> ShowS
$cshowsPrec :: Int -> S3Parameters -> ShowS
Prelude.Show, (forall x. S3Parameters -> Rep S3Parameters x)
-> (forall x. Rep S3Parameters x -> S3Parameters)
-> Generic S3Parameters
forall x. Rep S3Parameters x -> S3Parameters
forall x. S3Parameters -> Rep S3Parameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3Parameters x -> S3Parameters
$cfrom :: forall x. S3Parameters -> Rep S3Parameters x
Prelude.Generic)

-- |
-- Create a value of 'S3Parameters' 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:
--
-- 'manifestFileLocation', 's3Parameters_manifestFileLocation' - Location of the Amazon S3 manifest file. This is NULL if the manifest
-- file was uploaded into Amazon QuickSight.
newS3Parameters ::
  -- | 'manifestFileLocation'
  ManifestFileLocation ->
  S3Parameters
newS3Parameters :: ManifestFileLocation -> S3Parameters
newS3Parameters ManifestFileLocation
pManifestFileLocation_ =
  S3Parameters' :: ManifestFileLocation -> S3Parameters
S3Parameters'
    { $sel:manifestFileLocation:S3Parameters' :: ManifestFileLocation
manifestFileLocation =
        ManifestFileLocation
pManifestFileLocation_
    }

-- | Location of the Amazon S3 manifest file. This is NULL if the manifest
-- file was uploaded into Amazon QuickSight.
s3Parameters_manifestFileLocation :: Lens.Lens' S3Parameters ManifestFileLocation
s3Parameters_manifestFileLocation :: (ManifestFileLocation -> f ManifestFileLocation)
-> S3Parameters -> f S3Parameters
s3Parameters_manifestFileLocation = (S3Parameters -> ManifestFileLocation)
-> (S3Parameters -> ManifestFileLocation -> S3Parameters)
-> Lens
     S3Parameters S3Parameters ManifestFileLocation ManifestFileLocation
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Parameters' {ManifestFileLocation
manifestFileLocation :: ManifestFileLocation
$sel:manifestFileLocation:S3Parameters' :: S3Parameters -> ManifestFileLocation
manifestFileLocation} -> ManifestFileLocation
manifestFileLocation) (\s :: S3Parameters
s@S3Parameters' {} ManifestFileLocation
a -> S3Parameters
s {$sel:manifestFileLocation:S3Parameters' :: ManifestFileLocation
manifestFileLocation = ManifestFileLocation
a} :: S3Parameters)

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

instance Prelude.Hashable S3Parameters

instance Prelude.NFData S3Parameters

instance Core.ToJSON S3Parameters where
  toJSON :: S3Parameters -> Value
toJSON S3Parameters' {ManifestFileLocation
manifestFileLocation :: ManifestFileLocation
$sel:manifestFileLocation:S3Parameters' :: S3Parameters -> ManifestFileLocation
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ManifestFileLocation"
                  Text -> ManifestFileLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ManifestFileLocation
manifestFileLocation
              )
          ]
      )