{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DataBrew.Types.S3TableOutputOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataBrew.Types.S3Location
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
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]
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
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. 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' {$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 :: Lens' S3TableOutputOptions S3Location
s3TableOutputOptions_location = 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 Data.FromJSON S3TableOutputOptions where
  parseJSON :: Value -> Parser S3TableOutputOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3TableOutputOptions"
      ( \Object
x ->
          S3Location -> S3TableOutputOptions
S3TableOutputOptions'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Location")
      )

instance Prelude.Hashable S3TableOutputOptions where
  hashWithSalt :: Int -> S3TableOutputOptions -> Int
hashWithSalt Int
_salt S3TableOutputOptions' {S3Location
location :: S3Location
$sel:location:S3TableOutputOptions' :: S3TableOutputOptions -> S3Location
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3Location
location

instance Prelude.NFData S3TableOutputOptions where
  rnf :: S3TableOutputOptions -> ()
rnf S3TableOutputOptions' {S3Location
location :: S3Location
$sel:location:S3TableOutputOptions' :: S3TableOutputOptions -> S3Location
..} = forall a. NFData a => a -> ()
Prelude.rnf S3Location
location

instance Data.ToJSON S3TableOutputOptions where
  toJSON :: S3TableOutputOptions -> Value
toJSON S3TableOutputOptions' {S3Location
location :: S3Location
$sel:location:S3TableOutputOptions' :: S3TableOutputOptions -> S3Location
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Location" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3Location
location)]
      )