{-# 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.HoneyCode.Types.ImportDataSource
-- 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.HoneyCode.Types.ImportDataSource where

import qualified Amazonka.Core as Core
import Amazonka.HoneyCode.Types.ImportDataSourceConfig
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that has details about the source of the data that was
-- submitted for import.
--
-- /See:/ 'newImportDataSource' smart constructor.
data ImportDataSource = ImportDataSource'
  { -- | The configuration parameters for the data source of the import
    ImportDataSource -> ImportDataSourceConfig
dataSourceConfig :: ImportDataSourceConfig
  }
  deriving (ImportDataSource -> ImportDataSource -> Bool
(ImportDataSource -> ImportDataSource -> Bool)
-> (ImportDataSource -> ImportDataSource -> Bool)
-> Eq ImportDataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportDataSource -> ImportDataSource -> Bool
$c/= :: ImportDataSource -> ImportDataSource -> Bool
== :: ImportDataSource -> ImportDataSource -> Bool
$c== :: ImportDataSource -> ImportDataSource -> Bool
Prelude.Eq, ReadPrec [ImportDataSource]
ReadPrec ImportDataSource
Int -> ReadS ImportDataSource
ReadS [ImportDataSource]
(Int -> ReadS ImportDataSource)
-> ReadS [ImportDataSource]
-> ReadPrec ImportDataSource
-> ReadPrec [ImportDataSource]
-> Read ImportDataSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportDataSource]
$creadListPrec :: ReadPrec [ImportDataSource]
readPrec :: ReadPrec ImportDataSource
$creadPrec :: ReadPrec ImportDataSource
readList :: ReadS [ImportDataSource]
$creadList :: ReadS [ImportDataSource]
readsPrec :: Int -> ReadS ImportDataSource
$creadsPrec :: Int -> ReadS ImportDataSource
Prelude.Read, Int -> ImportDataSource -> ShowS
[ImportDataSource] -> ShowS
ImportDataSource -> String
(Int -> ImportDataSource -> ShowS)
-> (ImportDataSource -> String)
-> ([ImportDataSource] -> ShowS)
-> Show ImportDataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportDataSource] -> ShowS
$cshowList :: [ImportDataSource] -> ShowS
show :: ImportDataSource -> String
$cshow :: ImportDataSource -> String
showsPrec :: Int -> ImportDataSource -> ShowS
$cshowsPrec :: Int -> ImportDataSource -> ShowS
Prelude.Show, (forall x. ImportDataSource -> Rep ImportDataSource x)
-> (forall x. Rep ImportDataSource x -> ImportDataSource)
-> Generic ImportDataSource
forall x. Rep ImportDataSource x -> ImportDataSource
forall x. ImportDataSource -> Rep ImportDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportDataSource x -> ImportDataSource
$cfrom :: forall x. ImportDataSource -> Rep ImportDataSource x
Prelude.Generic)

-- |
-- Create a value of 'ImportDataSource' 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:
--
-- 'dataSourceConfig', 'importDataSource_dataSourceConfig' - The configuration parameters for the data source of the import
newImportDataSource ::
  -- | 'dataSourceConfig'
  ImportDataSourceConfig ->
  ImportDataSource
newImportDataSource :: ImportDataSourceConfig -> ImportDataSource
newImportDataSource ImportDataSourceConfig
pDataSourceConfig_ =
  ImportDataSource' :: ImportDataSourceConfig -> ImportDataSource
ImportDataSource'
    { $sel:dataSourceConfig:ImportDataSource' :: ImportDataSourceConfig
dataSourceConfig =
        ImportDataSourceConfig
pDataSourceConfig_
    }

-- | The configuration parameters for the data source of the import
importDataSource_dataSourceConfig :: Lens.Lens' ImportDataSource ImportDataSourceConfig
importDataSource_dataSourceConfig :: (ImportDataSourceConfig -> f ImportDataSourceConfig)
-> ImportDataSource -> f ImportDataSource
importDataSource_dataSourceConfig = (ImportDataSource -> ImportDataSourceConfig)
-> (ImportDataSource -> ImportDataSourceConfig -> ImportDataSource)
-> Lens
     ImportDataSource
     ImportDataSource
     ImportDataSourceConfig
     ImportDataSourceConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportDataSource' {ImportDataSourceConfig
dataSourceConfig :: ImportDataSourceConfig
$sel:dataSourceConfig:ImportDataSource' :: ImportDataSource -> ImportDataSourceConfig
dataSourceConfig} -> ImportDataSourceConfig
dataSourceConfig) (\s :: ImportDataSource
s@ImportDataSource' {} ImportDataSourceConfig
a -> ImportDataSource
s {$sel:dataSourceConfig:ImportDataSource' :: ImportDataSourceConfig
dataSourceConfig = ImportDataSourceConfig
a} :: ImportDataSource)

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

instance Prelude.Hashable ImportDataSource

instance Prelude.NFData ImportDataSource

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