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

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

-- | The reference to a dataset entry.
--
-- /See:/ 'newDatasetEntry' smart constructor.
data DatasetEntry = DatasetEntry'
  { -- | The name of the dataset item.
    DatasetEntry -> Maybe Text
entryName :: Prelude.Maybe Prelude.Text,
    -- | The presigned URI of the dataset item.
    DatasetEntry -> Maybe Text
dataURI :: Prelude.Maybe Prelude.Text
  }
  deriving (DatasetEntry -> DatasetEntry -> Bool
(DatasetEntry -> DatasetEntry -> Bool)
-> (DatasetEntry -> DatasetEntry -> Bool) -> Eq DatasetEntry
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]
(Int -> ReadS DatasetEntry)
-> ReadS [DatasetEntry]
-> ReadPrec DatasetEntry
-> ReadPrec [DatasetEntry]
-> Read 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
(Int -> DatasetEntry -> ShowS)
-> (DatasetEntry -> String)
-> ([DatasetEntry] -> ShowS)
-> Show DatasetEntry
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. DatasetEntry -> Rep DatasetEntry x)
-> (forall x. Rep DatasetEntry x -> DatasetEntry)
-> Generic DatasetEntry
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:
--
-- 'entryName', 'datasetEntry_entryName' - The name of the dataset item.
--
-- 'dataURI', 'datasetEntry_dataURI' - The presigned URI of the dataset item.
newDatasetEntry ::
  DatasetEntry
newDatasetEntry :: DatasetEntry
newDatasetEntry =
  DatasetEntry' :: Maybe Text -> Maybe Text -> DatasetEntry
DatasetEntry'
    { $sel:entryName:DatasetEntry' :: Maybe Text
entryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataURI:DatasetEntry' :: Maybe Text
dataURI = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the dataset item.
datasetEntry_entryName :: Lens.Lens' DatasetEntry (Prelude.Maybe Prelude.Text)
datasetEntry_entryName :: (Maybe Text -> f (Maybe Text)) -> DatasetEntry -> f DatasetEntry
datasetEntry_entryName = (DatasetEntry -> Maybe Text)
-> (DatasetEntry -> Maybe Text -> DatasetEntry)
-> Lens DatasetEntry DatasetEntry (Maybe Text) (Maybe Text)
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)

-- | The presigned URI of the dataset item.
datasetEntry_dataURI :: Lens.Lens' DatasetEntry (Prelude.Maybe Prelude.Text)
datasetEntry_dataURI :: (Maybe Text -> f (Maybe Text)) -> DatasetEntry -> f DatasetEntry
datasetEntry_dataURI = (DatasetEntry -> Maybe Text)
-> (DatasetEntry -> Maybe Text -> DatasetEntry)
-> Lens DatasetEntry DatasetEntry (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON DatasetEntry where
  parseJSON :: Value -> Parser DatasetEntry
parseJSON =
    String
-> (Object -> Parser DatasetEntry) -> Value -> Parser DatasetEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DatasetEntry"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> DatasetEntry
DatasetEntry'
            (Maybe Text -> Maybe Text -> DatasetEntry)
-> Parser (Maybe Text) -> Parser (Maybe Text -> DatasetEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"entryName")
            Parser (Maybe Text -> DatasetEntry)
-> Parser (Maybe Text) -> Parser DatasetEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dataURI")
      )

instance Prelude.Hashable DatasetEntry

instance Prelude.NFData DatasetEntry