{-# 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.IoTAnalytics.Types.DatasetEntry
-- 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.IoTAnalytics.Types.DatasetEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The reference to a dataset entry.
--
-- /See:/ 'newDatasetEntry' smart constructor.
data DatasetEntry = DatasetEntry'
  { -- | The presigned URI of the dataset item.
    DatasetEntry -> Maybe Text
dataURI :: Prelude.Maybe Prelude.Text,
    -- | The name of the dataset item.
    DatasetEntry -> Maybe Text
entryName :: Prelude.Maybe Prelude.Text
  }
  deriving (DatasetEntry -> DatasetEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatasetEntry -> DatasetEntry -> Bool
$c/= :: DatasetEntry -> DatasetEntry -> Bool
== :: DatasetEntry -> DatasetEntry -> Bool
$c== :: DatasetEntry -> DatasetEntry -> Bool
Prelude.Eq, ReadPrec [DatasetEntry]
ReadPrec DatasetEntry
Int -> ReadS DatasetEntry
ReadS [DatasetEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatasetEntry]
$creadListPrec :: ReadPrec [DatasetEntry]
readPrec :: ReadPrec DatasetEntry
$creadPrec :: ReadPrec DatasetEntry
readList :: ReadS [DatasetEntry]
$creadList :: ReadS [DatasetEntry]
readsPrec :: Int -> ReadS DatasetEntry
$creadsPrec :: Int -> ReadS DatasetEntry
Prelude.Read, Int -> DatasetEntry -> ShowS
[DatasetEntry] -> ShowS
DatasetEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatasetEntry] -> ShowS
$cshowList :: [DatasetEntry] -> ShowS
show :: DatasetEntry -> String
$cshow :: DatasetEntry -> String
showsPrec :: Int -> DatasetEntry -> ShowS
$cshowsPrec :: Int -> DatasetEntry -> ShowS
Prelude.Show, forall x. Rep DatasetEntry x -> DatasetEntry
forall x. DatasetEntry -> Rep DatasetEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatasetEntry x -> DatasetEntry
$cfrom :: forall x. DatasetEntry -> Rep DatasetEntry x
Prelude.Generic)

-- |
-- Create a value of 'DatasetEntry' 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:
--
-- 'dataURI', 'datasetEntry_dataURI' - The presigned URI of the dataset item.
--
-- 'entryName', 'datasetEntry_entryName' - The name of the dataset item.
newDatasetEntry ::
  DatasetEntry
newDatasetEntry :: DatasetEntry
newDatasetEntry =
  DatasetEntry'
    { $sel:dataURI:DatasetEntry' :: Maybe Text
dataURI = forall a. Maybe a
Prelude.Nothing,
      $sel:entryName:DatasetEntry' :: Maybe Text
entryName = forall a. Maybe a
Prelude.Nothing
    }

-- | The presigned URI of the dataset item.
datasetEntry_dataURI :: Lens.Lens' DatasetEntry (Prelude.Maybe Prelude.Text)
datasetEntry_dataURI :: Lens' DatasetEntry (Maybe Text)
datasetEntry_dataURI = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetEntry' {Maybe Text
dataURI :: Maybe Text
$sel:dataURI:DatasetEntry' :: DatasetEntry -> Maybe Text
dataURI} -> Maybe Text
dataURI) (\s :: DatasetEntry
s@DatasetEntry' {} Maybe Text
a -> DatasetEntry
s {$sel:dataURI:DatasetEntry' :: Maybe Text
dataURI = Maybe Text
a} :: DatasetEntry)

-- | The name of the dataset item.
datasetEntry_entryName :: Lens.Lens' DatasetEntry (Prelude.Maybe Prelude.Text)
datasetEntry_entryName :: Lens' DatasetEntry (Maybe Text)
datasetEntry_entryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetEntry' {Maybe Text
entryName :: Maybe Text
$sel:entryName:DatasetEntry' :: DatasetEntry -> Maybe Text
entryName} -> Maybe Text
entryName) (\s :: DatasetEntry
s@DatasetEntry' {} Maybe Text
a -> DatasetEntry
s {$sel:entryName:DatasetEntry' :: Maybe Text
entryName = Maybe Text
a} :: DatasetEntry)

instance Data.FromJSON DatasetEntry where
  parseJSON :: Value -> Parser DatasetEntry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DatasetEntry"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> DatasetEntry
DatasetEntry'
            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
"dataURI")
            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
"entryName")
      )

instance Prelude.Hashable DatasetEntry where
  hashWithSalt :: Int -> DatasetEntry -> Int
hashWithSalt Int
_salt DatasetEntry' {Maybe Text
entryName :: Maybe Text
dataURI :: Maybe Text
$sel:entryName:DatasetEntry' :: DatasetEntry -> Maybe Text
$sel:dataURI:DatasetEntry' :: DatasetEntry -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dataURI
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
entryName

instance Prelude.NFData DatasetEntry where
  rnf :: DatasetEntry -> ()
rnf DatasetEntry' {Maybe Text
entryName :: Maybe Text
dataURI :: Maybe Text
$sel:entryName:DatasetEntry' :: DatasetEntry -> Maybe Text
$sel:dataURI:DatasetEntry' :: DatasetEntry -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dataURI
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
entryName