{-# 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.FinSpaceData.Types.DataViewDestinationTypeParams
-- 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.FinSpaceData.Types.DataViewDestinationTypeParams where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FinSpaceData.Types.ExportFileFormat
import qualified Amazonka.Prelude as Prelude

-- | Structure for the Dataview destination type parameters.
--
-- /See:/ 'newDataViewDestinationTypeParams' smart constructor.
data DataViewDestinationTypeParams = DataViewDestinationTypeParams'
  { -- | Dataview export file format.
    --
    -- -   @PARQUET@ – Parquet export file format.
    --
    -- -   @DELIMITED_TEXT@ – Delimited text export file format.
    DataViewDestinationTypeParams -> Maybe ExportFileFormat
s3DestinationExportFileFormat :: Prelude.Maybe ExportFileFormat,
    -- | Format Options for S3 Destination type.
    --
    -- Here is an example of how you could specify the
    -- @s3DestinationExportFileFormatOptions@
    --
    -- @ { \"header\": \"true\", \"delimiter\": \",\", \"compression\": \"gzip\" }@
    DataViewDestinationTypeParams -> Maybe (HashMap Text Text)
s3DestinationExportFileFormatOptions :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Destination type for a Dataview.
    --
    -- -   @GLUE_TABLE@ – Glue table destination type.
    --
    -- -   @S3@ – S3 destination type.
    DataViewDestinationTypeParams -> Text
destinationType :: Prelude.Text
  }
  deriving (DataViewDestinationTypeParams
-> DataViewDestinationTypeParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataViewDestinationTypeParams
-> DataViewDestinationTypeParams -> Bool
$c/= :: DataViewDestinationTypeParams
-> DataViewDestinationTypeParams -> Bool
== :: DataViewDestinationTypeParams
-> DataViewDestinationTypeParams -> Bool
$c== :: DataViewDestinationTypeParams
-> DataViewDestinationTypeParams -> Bool
Prelude.Eq, ReadPrec [DataViewDestinationTypeParams]
ReadPrec DataViewDestinationTypeParams
Int -> ReadS DataViewDestinationTypeParams
ReadS [DataViewDestinationTypeParams]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataViewDestinationTypeParams]
$creadListPrec :: ReadPrec [DataViewDestinationTypeParams]
readPrec :: ReadPrec DataViewDestinationTypeParams
$creadPrec :: ReadPrec DataViewDestinationTypeParams
readList :: ReadS [DataViewDestinationTypeParams]
$creadList :: ReadS [DataViewDestinationTypeParams]
readsPrec :: Int -> ReadS DataViewDestinationTypeParams
$creadsPrec :: Int -> ReadS DataViewDestinationTypeParams
Prelude.Read, Int -> DataViewDestinationTypeParams -> ShowS
[DataViewDestinationTypeParams] -> ShowS
DataViewDestinationTypeParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataViewDestinationTypeParams] -> ShowS
$cshowList :: [DataViewDestinationTypeParams] -> ShowS
show :: DataViewDestinationTypeParams -> String
$cshow :: DataViewDestinationTypeParams -> String
showsPrec :: Int -> DataViewDestinationTypeParams -> ShowS
$cshowsPrec :: Int -> DataViewDestinationTypeParams -> ShowS
Prelude.Show, forall x.
Rep DataViewDestinationTypeParams x
-> DataViewDestinationTypeParams
forall x.
DataViewDestinationTypeParams
-> Rep DataViewDestinationTypeParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DataViewDestinationTypeParams x
-> DataViewDestinationTypeParams
$cfrom :: forall x.
DataViewDestinationTypeParams
-> Rep DataViewDestinationTypeParams x
Prelude.Generic)

-- |
-- Create a value of 'DataViewDestinationTypeParams' 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:
--
-- 's3DestinationExportFileFormat', 'dataViewDestinationTypeParams_s3DestinationExportFileFormat' - Dataview export file format.
--
-- -   @PARQUET@ – Parquet export file format.
--
-- -   @DELIMITED_TEXT@ – Delimited text export file format.
--
-- 's3DestinationExportFileFormatOptions', 'dataViewDestinationTypeParams_s3DestinationExportFileFormatOptions' - Format Options for S3 Destination type.
--
-- Here is an example of how you could specify the
-- @s3DestinationExportFileFormatOptions@
--
-- @ { \"header\": \"true\", \"delimiter\": \",\", \"compression\": \"gzip\" }@
--
-- 'destinationType', 'dataViewDestinationTypeParams_destinationType' - Destination type for a Dataview.
--
-- -   @GLUE_TABLE@ – Glue table destination type.
--
-- -   @S3@ – S3 destination type.
newDataViewDestinationTypeParams ::
  -- | 'destinationType'
  Prelude.Text ->
  DataViewDestinationTypeParams
newDataViewDestinationTypeParams :: Text -> DataViewDestinationTypeParams
newDataViewDestinationTypeParams Text
pDestinationType_ =
  DataViewDestinationTypeParams'
    { $sel:s3DestinationExportFileFormat:DataViewDestinationTypeParams' :: Maybe ExportFileFormat
s3DestinationExportFileFormat =
        forall a. Maybe a
Prelude.Nothing,
      $sel:s3DestinationExportFileFormatOptions:DataViewDestinationTypeParams' :: Maybe (HashMap Text Text)
s3DestinationExportFileFormatOptions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:destinationType:DataViewDestinationTypeParams' :: Text
destinationType = Text
pDestinationType_
    }

-- | Dataview export file format.
--
-- -   @PARQUET@ – Parquet export file format.
--
-- -   @DELIMITED_TEXT@ – Delimited text export file format.
dataViewDestinationTypeParams_s3DestinationExportFileFormat :: Lens.Lens' DataViewDestinationTypeParams (Prelude.Maybe ExportFileFormat)
dataViewDestinationTypeParams_s3DestinationExportFileFormat :: Lens' DataViewDestinationTypeParams (Maybe ExportFileFormat)
dataViewDestinationTypeParams_s3DestinationExportFileFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataViewDestinationTypeParams' {Maybe ExportFileFormat
s3DestinationExportFileFormat :: Maybe ExportFileFormat
$sel:s3DestinationExportFileFormat:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Maybe ExportFileFormat
s3DestinationExportFileFormat} -> Maybe ExportFileFormat
s3DestinationExportFileFormat) (\s :: DataViewDestinationTypeParams
s@DataViewDestinationTypeParams' {} Maybe ExportFileFormat
a -> DataViewDestinationTypeParams
s {$sel:s3DestinationExportFileFormat:DataViewDestinationTypeParams' :: Maybe ExportFileFormat
s3DestinationExportFileFormat = Maybe ExportFileFormat
a} :: DataViewDestinationTypeParams)

-- | Format Options for S3 Destination type.
--
-- Here is an example of how you could specify the
-- @s3DestinationExportFileFormatOptions@
--
-- @ { \"header\": \"true\", \"delimiter\": \",\", \"compression\": \"gzip\" }@
dataViewDestinationTypeParams_s3DestinationExportFileFormatOptions :: Lens.Lens' DataViewDestinationTypeParams (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
dataViewDestinationTypeParams_s3DestinationExportFileFormatOptions :: Lens' DataViewDestinationTypeParams (Maybe (HashMap Text Text))
dataViewDestinationTypeParams_s3DestinationExportFileFormatOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataViewDestinationTypeParams' {Maybe (HashMap Text Text)
s3DestinationExportFileFormatOptions :: Maybe (HashMap Text Text)
$sel:s3DestinationExportFileFormatOptions:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Maybe (HashMap Text Text)
s3DestinationExportFileFormatOptions} -> Maybe (HashMap Text Text)
s3DestinationExportFileFormatOptions) (\s :: DataViewDestinationTypeParams
s@DataViewDestinationTypeParams' {} Maybe (HashMap Text Text)
a -> DataViewDestinationTypeParams
s {$sel:s3DestinationExportFileFormatOptions:DataViewDestinationTypeParams' :: Maybe (HashMap Text Text)
s3DestinationExportFileFormatOptions = Maybe (HashMap Text Text)
a} :: DataViewDestinationTypeParams) 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

-- | Destination type for a Dataview.
--
-- -   @GLUE_TABLE@ – Glue table destination type.
--
-- -   @S3@ – S3 destination type.
dataViewDestinationTypeParams_destinationType :: Lens.Lens' DataViewDestinationTypeParams Prelude.Text
dataViewDestinationTypeParams_destinationType :: Lens' DataViewDestinationTypeParams Text
dataViewDestinationTypeParams_destinationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataViewDestinationTypeParams' {Text
destinationType :: Text
$sel:destinationType:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Text
destinationType} -> Text
destinationType) (\s :: DataViewDestinationTypeParams
s@DataViewDestinationTypeParams' {} Text
a -> DataViewDestinationTypeParams
s {$sel:destinationType:DataViewDestinationTypeParams' :: Text
destinationType = Text
a} :: DataViewDestinationTypeParams)

instance Data.FromJSON DataViewDestinationTypeParams where
  parseJSON :: Value -> Parser DataViewDestinationTypeParams
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DataViewDestinationTypeParams"
      ( \Object
x ->
          Maybe ExportFileFormat
-> Maybe (HashMap Text Text)
-> Text
-> DataViewDestinationTypeParams
DataViewDestinationTypeParams'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"s3DestinationExportFileFormat")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"s3DestinationExportFileFormatOptions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"destinationType")
      )

instance
  Prelude.Hashable
    DataViewDestinationTypeParams
  where
  hashWithSalt :: Int -> DataViewDestinationTypeParams -> Int
hashWithSalt Int
_salt DataViewDestinationTypeParams' {Maybe (HashMap Text Text)
Maybe ExportFileFormat
Text
destinationType :: Text
s3DestinationExportFileFormatOptions :: Maybe (HashMap Text Text)
s3DestinationExportFileFormat :: Maybe ExportFileFormat
$sel:destinationType:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Text
$sel:s3DestinationExportFileFormatOptions:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Maybe (HashMap Text Text)
$sel:s3DestinationExportFileFormat:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Maybe ExportFileFormat
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExportFileFormat
s3DestinationExportFileFormat
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
s3DestinationExportFileFormatOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationType

instance Prelude.NFData DataViewDestinationTypeParams where
  rnf :: DataViewDestinationTypeParams -> ()
rnf DataViewDestinationTypeParams' {Maybe (HashMap Text Text)
Maybe ExportFileFormat
Text
destinationType :: Text
s3DestinationExportFileFormatOptions :: Maybe (HashMap Text Text)
s3DestinationExportFileFormat :: Maybe ExportFileFormat
$sel:destinationType:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Text
$sel:s3DestinationExportFileFormatOptions:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Maybe (HashMap Text Text)
$sel:s3DestinationExportFileFormat:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Maybe ExportFileFormat
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ExportFileFormat
s3DestinationExportFileFormat
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
s3DestinationExportFileFormatOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
destinationType

instance Data.ToJSON DataViewDestinationTypeParams where
  toJSON :: DataViewDestinationTypeParams -> Value
toJSON DataViewDestinationTypeParams' {Maybe (HashMap Text Text)
Maybe ExportFileFormat
Text
destinationType :: Text
s3DestinationExportFileFormatOptions :: Maybe (HashMap Text Text)
s3DestinationExportFileFormat :: Maybe ExportFileFormat
$sel:destinationType:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Text
$sel:s3DestinationExportFileFormatOptions:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Maybe (HashMap Text Text)
$sel:s3DestinationExportFileFormat:DataViewDestinationTypeParams' :: DataViewDestinationTypeParams -> Maybe ExportFileFormat
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"s3DestinationExportFileFormat" 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 ExportFileFormat
s3DestinationExportFileFormat,
            (Key
"s3DestinationExportFileFormatOptions" 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 (HashMap Text Text)
s3DestinationExportFileFormatOptions,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"destinationType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
destinationType)
          ]
      )