{-# 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.M2.Types.DataSetImportConfig
-- 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.M2.Types.DataSetImportConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types.DataSetImportItem
import qualified Amazonka.Prelude as Prelude

-- | Identifies one or more data sets you want to import with the
-- CreateDataSetImportTask operation.
--
-- /See:/ 'newDataSetImportConfig' smart constructor.
data DataSetImportConfig = DataSetImportConfig'
  { -- | The data sets.
    DataSetImportConfig -> Maybe (NonEmpty DataSetImportItem)
dataSets :: Prelude.Maybe (Prelude.NonEmpty DataSetImportItem),
    -- | The Amazon S3 location of the data sets.
    DataSetImportConfig -> Maybe Text
s3Location :: Prelude.Maybe Prelude.Text
  }
  deriving (DataSetImportConfig -> DataSetImportConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataSetImportConfig -> DataSetImportConfig -> Bool
$c/= :: DataSetImportConfig -> DataSetImportConfig -> Bool
== :: DataSetImportConfig -> DataSetImportConfig -> Bool
$c== :: DataSetImportConfig -> DataSetImportConfig -> Bool
Prelude.Eq, ReadPrec [DataSetImportConfig]
ReadPrec DataSetImportConfig
Int -> ReadS DataSetImportConfig
ReadS [DataSetImportConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataSetImportConfig]
$creadListPrec :: ReadPrec [DataSetImportConfig]
readPrec :: ReadPrec DataSetImportConfig
$creadPrec :: ReadPrec DataSetImportConfig
readList :: ReadS [DataSetImportConfig]
$creadList :: ReadS [DataSetImportConfig]
readsPrec :: Int -> ReadS DataSetImportConfig
$creadsPrec :: Int -> ReadS DataSetImportConfig
Prelude.Read, Int -> DataSetImportConfig -> ShowS
[DataSetImportConfig] -> ShowS
DataSetImportConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataSetImportConfig] -> ShowS
$cshowList :: [DataSetImportConfig] -> ShowS
show :: DataSetImportConfig -> String
$cshow :: DataSetImportConfig -> String
showsPrec :: Int -> DataSetImportConfig -> ShowS
$cshowsPrec :: Int -> DataSetImportConfig -> ShowS
Prelude.Show, forall x. Rep DataSetImportConfig x -> DataSetImportConfig
forall x. DataSetImportConfig -> Rep DataSetImportConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataSetImportConfig x -> DataSetImportConfig
$cfrom :: forall x. DataSetImportConfig -> Rep DataSetImportConfig x
Prelude.Generic)

-- |
-- Create a value of 'DataSetImportConfig' 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:
--
-- 'dataSets', 'dataSetImportConfig_dataSets' - The data sets.
--
-- 's3Location', 'dataSetImportConfig_s3Location' - The Amazon S3 location of the data sets.
newDataSetImportConfig ::
  DataSetImportConfig
newDataSetImportConfig :: DataSetImportConfig
newDataSetImportConfig =
  DataSetImportConfig'
    { $sel:dataSets:DataSetImportConfig' :: Maybe (NonEmpty DataSetImportItem)
dataSets = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Location:DataSetImportConfig' :: Maybe Text
s3Location = forall a. Maybe a
Prelude.Nothing
    }

-- | The data sets.
dataSetImportConfig_dataSets :: Lens.Lens' DataSetImportConfig (Prelude.Maybe (Prelude.NonEmpty DataSetImportItem))
dataSetImportConfig_dataSets :: Lens' DataSetImportConfig (Maybe (NonEmpty DataSetImportItem))
dataSetImportConfig_dataSets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSetImportConfig' {Maybe (NonEmpty DataSetImportItem)
dataSets :: Maybe (NonEmpty DataSetImportItem)
$sel:dataSets:DataSetImportConfig' :: DataSetImportConfig -> Maybe (NonEmpty DataSetImportItem)
dataSets} -> Maybe (NonEmpty DataSetImportItem)
dataSets) (\s :: DataSetImportConfig
s@DataSetImportConfig' {} Maybe (NonEmpty DataSetImportItem)
a -> DataSetImportConfig
s {$sel:dataSets:DataSetImportConfig' :: Maybe (NonEmpty DataSetImportItem)
dataSets = Maybe (NonEmpty DataSetImportItem)
a} :: DataSetImportConfig) 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

-- | The Amazon S3 location of the data sets.
dataSetImportConfig_s3Location :: Lens.Lens' DataSetImportConfig (Prelude.Maybe Prelude.Text)
dataSetImportConfig_s3Location :: Lens' DataSetImportConfig (Maybe Text)
dataSetImportConfig_s3Location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSetImportConfig' {Maybe Text
s3Location :: Maybe Text
$sel:s3Location:DataSetImportConfig' :: DataSetImportConfig -> Maybe Text
s3Location} -> Maybe Text
s3Location) (\s :: DataSetImportConfig
s@DataSetImportConfig' {} Maybe Text
a -> DataSetImportConfig
s {$sel:s3Location:DataSetImportConfig' :: Maybe Text
s3Location = Maybe Text
a} :: DataSetImportConfig)

instance Prelude.Hashable DataSetImportConfig where
  hashWithSalt :: Int -> DataSetImportConfig -> Int
hashWithSalt Int
_salt DataSetImportConfig' {Maybe (NonEmpty DataSetImportItem)
Maybe Text
s3Location :: Maybe Text
dataSets :: Maybe (NonEmpty DataSetImportItem)
$sel:s3Location:DataSetImportConfig' :: DataSetImportConfig -> Maybe Text
$sel:dataSets:DataSetImportConfig' :: DataSetImportConfig -> Maybe (NonEmpty DataSetImportItem)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty DataSetImportItem)
dataSets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Location

instance Prelude.NFData DataSetImportConfig where
  rnf :: DataSetImportConfig -> ()
rnf DataSetImportConfig' {Maybe (NonEmpty DataSetImportItem)
Maybe Text
s3Location :: Maybe Text
dataSets :: Maybe (NonEmpty DataSetImportItem)
$sel:s3Location:DataSetImportConfig' :: DataSetImportConfig -> Maybe Text
$sel:dataSets:DataSetImportConfig' :: DataSetImportConfig -> Maybe (NonEmpty DataSetImportItem)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty DataSetImportItem)
dataSets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Location

instance Data.ToJSON DataSetImportConfig where
  toJSON :: DataSetImportConfig -> Value
toJSON DataSetImportConfig' {Maybe (NonEmpty DataSetImportItem)
Maybe Text
s3Location :: Maybe Text
dataSets :: Maybe (NonEmpty DataSetImportItem)
$sel:s3Location:DataSetImportConfig' :: DataSetImportConfig -> Maybe Text
$sel:dataSets:DataSetImportConfig' :: DataSetImportConfig -> Maybe (NonEmpty DataSetImportItem)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"dataSets" 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 (NonEmpty DataSetImportItem)
dataSets,
            (Key
"s3Location" 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 Text
s3Location
          ]
      )