{-# 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.DataSetImportItem
-- 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.DataSetImportItem 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.DataSet
import Amazonka.M2.Types.ExternalLocation
import qualified Amazonka.Prelude as Prelude

-- | Identifies a specific data set to import from an external location.
--
-- /See:/ 'newDataSetImportItem' smart constructor.
data DataSetImportItem = DataSetImportItem'
  { -- | The data set.
    DataSetImportItem -> DataSet
dataSet :: DataSet,
    -- | The location of the data set.
    DataSetImportItem -> ExternalLocation
externalLocation :: ExternalLocation
  }
  deriving (DataSetImportItem -> DataSetImportItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataSetImportItem -> DataSetImportItem -> Bool
$c/= :: DataSetImportItem -> DataSetImportItem -> Bool
== :: DataSetImportItem -> DataSetImportItem -> Bool
$c== :: DataSetImportItem -> DataSetImportItem -> Bool
Prelude.Eq, ReadPrec [DataSetImportItem]
ReadPrec DataSetImportItem
Int -> ReadS DataSetImportItem
ReadS [DataSetImportItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataSetImportItem]
$creadListPrec :: ReadPrec [DataSetImportItem]
readPrec :: ReadPrec DataSetImportItem
$creadPrec :: ReadPrec DataSetImportItem
readList :: ReadS [DataSetImportItem]
$creadList :: ReadS [DataSetImportItem]
readsPrec :: Int -> ReadS DataSetImportItem
$creadsPrec :: Int -> ReadS DataSetImportItem
Prelude.Read, Int -> DataSetImportItem -> ShowS
[DataSetImportItem] -> ShowS
DataSetImportItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataSetImportItem] -> ShowS
$cshowList :: [DataSetImportItem] -> ShowS
show :: DataSetImportItem -> String
$cshow :: DataSetImportItem -> String
showsPrec :: Int -> DataSetImportItem -> ShowS
$cshowsPrec :: Int -> DataSetImportItem -> ShowS
Prelude.Show, forall x. Rep DataSetImportItem x -> DataSetImportItem
forall x. DataSetImportItem -> Rep DataSetImportItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataSetImportItem x -> DataSetImportItem
$cfrom :: forall x. DataSetImportItem -> Rep DataSetImportItem x
Prelude.Generic)

-- |
-- Create a value of 'DataSetImportItem' 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:
--
-- 'dataSet', 'dataSetImportItem_dataSet' - The data set.
--
-- 'externalLocation', 'dataSetImportItem_externalLocation' - The location of the data set.
newDataSetImportItem ::
  -- | 'dataSet'
  DataSet ->
  -- | 'externalLocation'
  ExternalLocation ->
  DataSetImportItem
newDataSetImportItem :: DataSet -> ExternalLocation -> DataSetImportItem
newDataSetImportItem DataSet
pDataSet_ ExternalLocation
pExternalLocation_ =
  DataSetImportItem'
    { $sel:dataSet:DataSetImportItem' :: DataSet
dataSet = DataSet
pDataSet_,
      $sel:externalLocation:DataSetImportItem' :: ExternalLocation
externalLocation = ExternalLocation
pExternalLocation_
    }

-- | The data set.
dataSetImportItem_dataSet :: Lens.Lens' DataSetImportItem DataSet
dataSetImportItem_dataSet :: Lens' DataSetImportItem DataSet
dataSetImportItem_dataSet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSetImportItem' {DataSet
dataSet :: DataSet
$sel:dataSet:DataSetImportItem' :: DataSetImportItem -> DataSet
dataSet} -> DataSet
dataSet) (\s :: DataSetImportItem
s@DataSetImportItem' {} DataSet
a -> DataSetImportItem
s {$sel:dataSet:DataSetImportItem' :: DataSet
dataSet = DataSet
a} :: DataSetImportItem)

-- | The location of the data set.
dataSetImportItem_externalLocation :: Lens.Lens' DataSetImportItem ExternalLocation
dataSetImportItem_externalLocation :: Lens' DataSetImportItem ExternalLocation
dataSetImportItem_externalLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSetImportItem' {ExternalLocation
externalLocation :: ExternalLocation
$sel:externalLocation:DataSetImportItem' :: DataSetImportItem -> ExternalLocation
externalLocation} -> ExternalLocation
externalLocation) (\s :: DataSetImportItem
s@DataSetImportItem' {} ExternalLocation
a -> DataSetImportItem
s {$sel:externalLocation:DataSetImportItem' :: ExternalLocation
externalLocation = ExternalLocation
a} :: DataSetImportItem)

instance Prelude.Hashable DataSetImportItem where
  hashWithSalt :: Int -> DataSetImportItem -> Int
hashWithSalt Int
_salt DataSetImportItem' {ExternalLocation
DataSet
externalLocation :: ExternalLocation
dataSet :: DataSet
$sel:externalLocation:DataSetImportItem' :: DataSetImportItem -> ExternalLocation
$sel:dataSet:DataSetImportItem' :: DataSetImportItem -> DataSet
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DataSet
dataSet
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ExternalLocation
externalLocation

instance Prelude.NFData DataSetImportItem where
  rnf :: DataSetImportItem -> ()
rnf DataSetImportItem' {ExternalLocation
DataSet
externalLocation :: ExternalLocation
dataSet :: DataSet
$sel:externalLocation:DataSetImportItem' :: DataSetImportItem -> ExternalLocation
$sel:dataSet:DataSetImportItem' :: DataSetImportItem -> DataSet
..} =
    forall a. NFData a => a -> ()
Prelude.rnf DataSet
dataSet
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ExternalLocation
externalLocation

instance Data.ToJSON DataSetImportItem where
  toJSON :: DataSetImportItem -> Value
toJSON DataSetImportItem' {ExternalLocation
DataSet
externalLocation :: ExternalLocation
dataSet :: DataSet
$sel:externalLocation:DataSetImportItem' :: DataSetImportItem -> ExternalLocation
$sel:dataSet:DataSetImportItem' :: DataSetImportItem -> DataSet
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"dataSet" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DataSet
dataSet),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"externalLocation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ExternalLocation
externalLocation)
          ]
      )