{-# 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.DataBrew.Types.S3TableOutputOptions
-- 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.DataBrew.Types.S3TableOutputOptions where

import qualified Amazonka.Core as Core
import Amazonka.DataBrew.Types.S3Location
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents options that specify how and where DataBrew writes the Amazon
-- S3 output generated by recipe jobs.
--
-- /See:/ 'newS3TableOutputOptions' smart constructor.
data S3TableOutputOptions = S3TableOutputOptions'
  { -- | Represents an Amazon S3 location (bucket name and object key) where
    -- DataBrew can write output from a job.
    S3TableOutputOptions -> S3Location
location :: S3Location
  }
  deriving (S3TableOutputOptions -> S3TableOutputOptions -> Bool
(S3TableOutputOptions -> S3TableOutputOptions -> Bool)
-> (S3TableOutputOptions -> S3TableOutputOptions -> Bool)
-> Eq S3TableOutputOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3TableOutputOptions -> S3TableOutputOptions -> Bool
$c/= :: S3TableOutputOptions -> S3TableOutputOptions -> Bool
== :: S3TableOutputOptions -> S3TableOutputOptions -> Bool
$c== :: S3TableOutputOptions -> S3TableOutputOptions -> Bool
Prelude.Eq, ReadPrec [S3TableOutputOptions]
ReadPrec S3TableOutputOptions
Int -> ReadS S3TableOutputOptions
ReadS [S3TableOutputOptions]
(Int -> ReadS S3TableOutputOptions)
-> ReadS [S3TableOutputOptions]
-> ReadPrec S3TableOutputOptions
-> ReadPrec [S3TableOutputOptions]
-> Read S3TableOutputOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3TableOutputOptions]
$creadListPrec :: ReadPrec [S3TableOutputOptions]
readPrec :: ReadPrec S3TableOutputOptions
$creadPrec :: ReadPrec S3TableOutputOptions
readList :: ReadS [S3TableOutputOptions]
$creadList :: ReadS [S3TableOutputOptions]
readsPrec :: Int -> ReadS S3TableOutputOptions
$creadsPrec :: Int -> ReadS S3TableOutputOptions
Prelude.Read, Int -> S3TableOutputOptions -> ShowS
[S3TableOutputOptions] -> ShowS
S3TableOutputOptions -> String
(Int -> S3TableOutputOptions -> ShowS)
-> (S3TableOutputOptions -> String)
-> ([S3TableOutputOptions] -> ShowS)
-> Show S3TableOutputOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3TableOutputOptions] -> ShowS
$cshowList :: [S3TableOutputOptions] -> ShowS
show :: S3TableOutputOptions -> String
$cshow :: S3TableOutputOptions -> String
showsPrec :: Int -> S3TableOutputOptions -> ShowS
$cshowsPrec :: Int -> S3TableOutputOptions -> ShowS
Prelude.Show, (forall x. S3TableOutputOptions -> Rep S3TableOutputOptions x)
-> (forall x. Rep S3TableOutputOptions x -> S3TableOutputOptions)
-> Generic S3TableOutputOptions
forall x. Rep S3TableOutputOptions x -> S3TableOutputOptions
forall x. S3TableOutputOptions -> Rep S3TableOutputOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3TableOutputOptions x -> S3TableOutputOptions
$cfrom :: forall x. S3TableOutputOptions -> Rep S3TableOutputOptions x
Prelude.Generic)

-- |
-- Create a value of 'S3TableOutputOptions' 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:
--
-- 'location', 's3TableOutputOptions_location' - Represents an Amazon S3 location (bucket name and object key) where
-- DataBrew can write output from a job.
newS3TableOutputOptions ::
  -- | 'location'
  S3Location ->
  S3TableOutputOptions
newS3TableOutputOptions :: S3Location -> S3TableOutputOptions
newS3TableOutputOptions S3Location
pLocation_ =
  S3TableOutputOptions' :: S3Location -> S3TableOutputOptions
S3TableOutputOptions' {$sel:location:S3TableOutputOptions' :: S3Location
location = S3Location
pLocation_}

-- | Represents an Amazon S3 location (bucket name and object key) where
-- DataBrew can write output from a job.
s3TableOutputOptions_location :: Lens.Lens' S3TableOutputOptions S3Location
s3TableOutputOptions_location :: (S3Location -> f S3Location)
-> S3TableOutputOptions -> f S3TableOutputOptions
s3TableOutputOptions_location = (S3TableOutputOptions -> S3Location)
-> (S3TableOutputOptions -> S3Location -> S3TableOutputOptions)
-> Lens
     S3TableOutputOptions S3TableOutputOptions S3Location S3Location
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3TableOutputOptions' {S3Location
location :: S3Location
$sel:location:S3TableOutputOptions' :: S3TableOutputOptions -> S3Location
location} -> S3Location
location) (\s :: S3TableOutputOptions
s@S3TableOutputOptions' {} S3Location
a -> S3TableOutputOptions
s {$sel:location:S3TableOutputOptions' :: S3Location
location = S3Location
a} :: S3TableOutputOptions)

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

instance Prelude.Hashable S3TableOutputOptions

instance Prelude.NFData S3TableOutputOptions

instance Core.ToJSON S3TableOutputOptions where
  toJSON :: S3TableOutputOptions -> Value
toJSON S3TableOutputOptions' {S3Location
location :: S3Location
$sel:location:S3TableOutputOptions' :: S3TableOutputOptions -> S3Location
..} =
    [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
"Location" Text -> S3Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= S3Location
location)]
      )